Search bar anchor
This commit is contained in:
@@ -49,4 +49,13 @@ String PollStdout(Allocator allocator, Process *process);
|
|||||||
void WriteStdin(Process *process, String string);
|
void WriteStdin(Process *process, String string);
|
||||||
void CloseStdin(Process *process);
|
void CloseStdin(Process *process);
|
||||||
|
|
||||||
double get_time_in_micros(void);
|
double get_time_in_micros(void);
|
||||||
|
|
||||||
|
enum MakeDirResult {
|
||||||
|
MakeDirResult_Success,
|
||||||
|
MakeDirResult_Exists,
|
||||||
|
MakeDirResult_NotFound,
|
||||||
|
MakeDirResult_ErrorOther,
|
||||||
|
};
|
||||||
|
|
||||||
|
MakeDirResult MakeDir(String path);
|
||||||
@@ -276,13 +276,6 @@ int64_t GetFileModTime(String file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MakeDirResult {
|
|
||||||
MakeDirResult_Success,
|
|
||||||
MakeDirResult_Exists,
|
|
||||||
MakeDirResult_NotFound,
|
|
||||||
MakeDirResult_ErrorOther,
|
|
||||||
};
|
|
||||||
|
|
||||||
MakeDirResult MakeDir(String path) {
|
MakeDirResult MakeDir(String path) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
MakeDirResult result = MakeDirResult_Success;
|
MakeDirResult result = MakeDirResult_Success;
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ void Command_MoveCursorsByPageSize(Window *window, int direction, bool shift = f
|
|||||||
BSet set = GetBSet(window);
|
BSet set = GetBSet(window);
|
||||||
CheckpointBeforeGoto(window);
|
CheckpointBeforeGoto(window);
|
||||||
|
|
||||||
|
|
||||||
Rect2I visible_cells_rect = GetVisibleCells(window);
|
Rect2I visible_cells_rect = GetVisibleCells(window);
|
||||||
Int y = GetSize(visible_cells_rect).y - 2;
|
Int y = GetSize(visible_cells_rect).y - 2;
|
||||||
if (direction == DIR_UP) y = -y;
|
if (direction == DIR_UP) y = -y;
|
||||||
|
|||||||
@@ -446,10 +446,12 @@ void OnCommand(Event event) {
|
|||||||
} else if (AltShiftPress(SDLK_DOWN)) {
|
} else if (AltShiftPress(SDLK_DOWN)) {
|
||||||
Command_CreateCursorVertical(active.view, DIR_DOWN);
|
Command_CreateCursorVertical(active.view, DIR_DOWN);
|
||||||
} else if (CtrlShiftPress(SDLK_DOWN)) {
|
} else if (CtrlShiftPress(SDLK_DOWN)) {
|
||||||
|
CheckpointBeforeGoto(active.window);
|
||||||
Command_Move(active.view, DIR_DOWN, CTRL_PRESSED, SHIFT_PRESSED);
|
Command_Move(active.view, DIR_DOWN, CTRL_PRESSED, SHIFT_PRESSED);
|
||||||
} else if (AltPress(SDLK_DOWN)) {
|
} else if (AltPress(SDLK_DOWN)) {
|
||||||
Command_MoveLine(active.view, DIR_DOWN);
|
Command_MoveLine(active.view, DIR_DOWN);
|
||||||
} else if (CtrlPress(SDLK_DOWN)) {
|
} else if (CtrlPress(SDLK_DOWN)) {
|
||||||
|
CheckpointBeforeGoto(active.window);
|
||||||
Command_Move(active.view, DIR_DOWN, CTRL_PRESSED);
|
Command_Move(active.view, DIR_DOWN, CTRL_PRESSED);
|
||||||
} else if (ShiftPress(SDLK_DOWN)) {
|
} else if (ShiftPress(SDLK_DOWN)) {
|
||||||
Command_Move(active.view, DIR_DOWN, false, SHIFT_PRESSED);
|
Command_Move(active.view, DIR_DOWN, false, SHIFT_PRESSED);
|
||||||
@@ -462,10 +464,12 @@ void OnCommand(Event event) {
|
|||||||
} else if (AltShiftPress(SDLK_UP)) {
|
} else if (AltShiftPress(SDLK_UP)) {
|
||||||
Command_CreateCursorVertical(active.view, DIR_UP);
|
Command_CreateCursorVertical(active.view, DIR_UP);
|
||||||
} else if (CtrlShiftPress(SDLK_UP)) {
|
} else if (CtrlShiftPress(SDLK_UP)) {
|
||||||
|
CheckpointBeforeGoto(active.window);
|
||||||
Command_Move(active.view, DIR_UP, CTRL_PRESSED, SHIFT_PRESSED);
|
Command_Move(active.view, DIR_UP, CTRL_PRESSED, SHIFT_PRESSED);
|
||||||
} else if (AltPress(SDLK_UP)) {
|
} else if (AltPress(SDLK_UP)) {
|
||||||
Command_MoveLine(active.view, DIR_UP);
|
Command_MoveLine(active.view, DIR_UP);
|
||||||
} else if (CtrlPress(SDLK_UP)) {
|
} else if (CtrlPress(SDLK_UP)) {
|
||||||
|
CheckpointBeforeGoto(active.window);
|
||||||
Command_Move(active.view, DIR_UP, CTRL_PRESSED);
|
Command_Move(active.view, DIR_UP, CTRL_PRESSED);
|
||||||
} else if (ShiftPress(SDLK_UP)) {
|
} else if (ShiftPress(SDLK_UP)) {
|
||||||
Command_Move(active.view, DIR_UP, false, SHIFT_PRESSED);
|
Command_Move(active.view, DIR_UP, false, SHIFT_PRESSED);
|
||||||
@@ -593,11 +597,15 @@ void OnCommand(Event event) {
|
|||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String16 search_string = GetSearchString(main.window);
|
String16 search_string = GetSearchString(main.window);
|
||||||
Caret caret = FindPrev(main.buffer, search_string, main.view->carets[0]);
|
Caret caret = FindPrev(main.buffer, search_string, main.view->carets[0]);
|
||||||
|
BSet search = GetBSet(main.window->search_bar_window);
|
||||||
|
search.window->search_bar_anchor = caret;
|
||||||
Command_SelectRangeOneCursor(main.view, caret);
|
Command_SelectRangeOneCursor(main.view, caret);
|
||||||
} else if (Press(SDLK_F3)) {
|
} else if (Press(SDLK_F3)) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String16 search_string = GetSearchString(main.window);
|
String16 search_string = GetSearchString(main.window);
|
||||||
Caret caret = FindNext(main.buffer, search_string, main.view->carets[0]);
|
Caret caret = FindNext(main.buffer, search_string, main.view->carets[0]);
|
||||||
|
BSet search = GetBSet(main.window->search_bar_window);
|
||||||
|
search.window->search_bar_anchor = caret;
|
||||||
Command_SelectRangeOneCursor(main.view, caret);
|
Command_SelectRangeOneCursor(main.view, caret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,6 +627,7 @@ void OnCommand(Event event) {
|
|||||||
}
|
}
|
||||||
Command_SelectEntireBuffer(search.view);
|
Command_SelectEntireBuffer(search.view);
|
||||||
search.window->visible = 1;
|
search.window->visible = 1;
|
||||||
|
search.window->search_bar_anchor = main.view->carets[0];
|
||||||
ActiveWindow = search.window->id;
|
ActiveWindow = search.window->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -719,6 +728,7 @@ void OnCommand(Event event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (active.window->is_search_bar && buffer_change_id != active.buffer->change_id) {
|
if (active.window->is_search_bar && buffer_change_id != active.buffer->change_id) {
|
||||||
|
main.view->carets[0] = active.window->search_bar_anchor;
|
||||||
Command_Find(main.view, GetSearchString(main.window), true);
|
Command_Find(main.view, GetSearchString(main.window), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
struct Window; struct View; struct WindowSplit;
|
struct Window; struct View; struct WindowSplit;
|
||||||
struct ViewID { Int id; View *o; };
|
struct ViewID { Int id; View *o; };
|
||||||
struct WindowID { Int id; Window *o; }; // @todo: change name of object to something scary
|
struct WindowID { Int id; Window *o; };
|
||||||
|
|
||||||
|
|
||||||
struct View {
|
struct View {
|
||||||
@@ -47,6 +47,7 @@ struct Window {
|
|||||||
ViewID active_goto_list;
|
ViewID active_goto_list;
|
||||||
Int goto_list_pos;
|
Int goto_list_pos;
|
||||||
|
|
||||||
|
Caret search_bar_anchor;
|
||||||
double mouse_scroller_offset;
|
double mouse_scroller_offset;
|
||||||
int z;
|
int z;
|
||||||
|
|
||||||
@@ -93,15 +94,6 @@ struct BSet {
|
|||||||
Buffer *buffer;
|
Buffer *buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MakeDirResult {
|
|
||||||
MakeDirResult_Success,
|
|
||||||
MakeDirResult_Exists,
|
|
||||||
MakeDirResult_NotFound,
|
|
||||||
MakeDirResult_ErrorOther,
|
|
||||||
};
|
|
||||||
|
|
||||||
MakeDirResult MakeDir(String path);
|
|
||||||
|
|
||||||
// @WARNING: be careful about using this, should only be used for debugging
|
// @WARNING: be careful about using this, should only be used for debugging
|
||||||
// the problem with this is that we want events to be reproducible.
|
// the problem with this is that we want events to be reproducible.
|
||||||
// We eat as many events as we can in a frame, we abstract the frame and so on.
|
// We eat as many events as we can in a frame, we abstract the frame and so on.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
- Lua OnCommand should be able to comunicate that we don't want C handling and do only the Lua handling
|
- Lua OnCommand should be able to comunicate that we don't want C handling and do only the Lua handling
|
||||||
- Easily programmable F1-F12 commands
|
- Easily programmable F1-F12 commands
|
||||||
- Lua namespaces for different kinds of commands (by ids, using main_set, using active_set)?
|
- Lua namespaces for different kinds of commands (by ids, using main_set, using active_set)?
|
||||||
|
- List all files in project, exclude by lua pattern
|
||||||
|
|
||||||
- Set window layout using project file
|
- Set window layout using project file
|
||||||
- Split command
|
- Split command
|
||||||
@@ -17,19 +18,16 @@
|
|||||||
- Set active window using id
|
- Set active window using id
|
||||||
- Fix jump scroll, the query ends up the last line on screen, kind of wacky
|
- Fix jump scroll, the query ends up the last line on screen, kind of wacky
|
||||||
- Fix Ctrl+1 Ctrl+2 (choosing window)
|
- Fix Ctrl+1 Ctrl+2 (choosing window)
|
||||||
- Fix search, should have an anchor
|
|
||||||
- Use project file as working dir instead of scratch buffer path, separate project dir and project file
|
- Use project file as working dir instead of scratch buffer path, separate project dir and project file
|
||||||
- Remedybg integration
|
- Remedybg integration
|
||||||
- GetLine()
|
- GetLine()
|
||||||
- in lua start debugging, jump to line, start debugger on file
|
- in lua start debugging, jump to line, start debugger on file
|
||||||
- Enclose scope
|
|
||||||
|
|
||||||
- save all relevant buffers and build
|
- save all relevant buffers and build
|
||||||
- maybe most of the bindings should be in lua, but actual code in C
|
- maybe most of the bindings should be in lua, but actual code in C
|
||||||
- maybe less code should be in lua ?? Lua code is very dodgey to change
|
- maybe less code should be in lua ?? Lua code is very dodgey to change
|
||||||
- LoadWord, EncloseWord configurable?
|
- LoadWord, EncloseWord configurable?
|
||||||
- dump text editor state to file, restore state
|
- dump text editor state to file, restore state
|
||||||
- help menu popup when for example in process buffer, on tile bar buffer and stuff like that
|
|
||||||
- proper lister
|
- proper lister
|
||||||
|
|
||||||
- ask user if he really wants to quit even though he has an unsaved buffer - popup window | we could just show ForceClose() in the titlebar
|
- ask user if he really wants to quit even though he has an unsaved buffer - popup window | we could just show ForceClose() in the titlebar
|
||||||
|
|||||||
Reference in New Issue
Block a user