Small improvements

This commit is contained in:
Krzosa Karol
2024-07-24 16:28:44 +02:00
parent 1cd5e71904
commit d1b4053205
2 changed files with 15 additions and 3 deletions

View File

@@ -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, {});
}

View File

@@ -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)