From d1b4053205dc0c33450df5b6063fde2c647697ee Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Wed, 24 Jul 2024 16:28:44 +0200 Subject: [PATCH] Small improvements --- src/text_editor/commands_window.cpp | 17 +++++++++++++++-- src/text_editor/text_editor.cpp | 1 - 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/text_editor/commands_window.cpp b/src/text_editor/commands_window.cpp index b4a5897..00bb514 100644 --- a/src/text_editor/commands_window.cpp +++ b/src/text_editor/commands_window.cpp @@ -43,7 +43,14 @@ void Command_MoveCursorsByPageSize(Window *window, int direction, bool shift = f For(view.carets) { XY xy = PosToXY(*buffer, GetFront(it)); + if (direction == DIR_DOWN && xy.line == buffer->line_starts.len - 1) { + Range line_range = GetLineRange(*buffer, xy.line); + xy.col = line_range.max - line_range.min; + } else if (direction == DIR_UP && xy.line == 0) { + xy.col = 0; + } xy.line += y; + Int pos = XYToPos(*buffer, xy); if (shift) { it = ChangeFront(it, pos); @@ -552,9 +559,15 @@ void ReplaceInfobarData() { } Scratch scratch; - String error = {}; + String16 buffer_string = GetString(*buffer); + + Range replace_range = {0, buffer->len}; + if (!Seek(buffer_string, L"|", &replace_range.max)) { + ReplaceText(buffer, GetEndAsRange(*buffer), L"|"); + } + String s = Format(scratch, "line: %5lld col: %5lld name: %.*s", (long long)xy.line + 1ll, (long long)xy.col + 1ll, FmtString(name)); String16 string = ToString16(scratch, s); - ReplaceText(buffer, {0, buffer->len}, string); + ReplaceText(buffer, replace_range, string); Command_SelectRangeOneCursor(view, {}); } \ No newline at end of file diff --git a/src/text_editor/text_editor.cpp b/src/text_editor/text_editor.cpp index 36a46d6..3bd5738 100644 --- a/src/text_editor/text_editor.cpp +++ b/src/text_editor/text_editor.cpp @@ -31,7 +31,6 @@ #include "lua_api.cpp" /* -- fix pathing in open, make it predictable - update info bar until '|' if tghere is no sign delete whole - Save file (utf16->utf8)