Mouse rewrite
This commit is contained in:
@@ -93,7 +93,7 @@ void CheckpointBeforeGoto() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GoBackToLastCrumb() {
|
void GoBackToLastCrumb() {
|
||||||
Window *window = GetWindow(ActiveWindow);
|
Window *window = GetWindow(GetLastActiveWindow());
|
||||||
if (GotoCrumbs.len <= 0) return;
|
if (GotoCrumbs.len <= 0) return;
|
||||||
GotoCrumb c = Pop(&GotoCrumbs);
|
GotoCrumb c = Pop(&GotoCrumbs);
|
||||||
Buffer *buffer = GetBuffer(c.buffer_id);
|
Buffer *buffer = GetBuffer(c.buffer_id);
|
||||||
@@ -188,8 +188,8 @@ bool GlobalCommand(Event event) {
|
|||||||
|
|
||||||
Vec2I mouse = MouseVec2I();
|
Vec2I mouse = MouseVec2I();
|
||||||
Int p = ScreenSpaceToBufferPos(window, view, buffer, mouse);
|
Int p = ScreenSpaceToBufferPos(window, view, buffer, mouse);
|
||||||
|
|
||||||
Caret &caret = view->carets[0];
|
Caret &caret = view->carets[0];
|
||||||
|
|
||||||
caret = SetFrontWithAnchor(caret, DocumentRangeAnchor, p);
|
caret = SetFrontWithAnchor(caret, DocumentRangeAnchor, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +242,8 @@ bool GlobalCommand(Event event) {
|
|||||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||||
Int p = ScreenSpaceToBufferPosErrorOutOfBounds(window, view, buffer, mouse);
|
Int p = ScreenSpaceToBufferPosErrorOutOfBounds(window, view, buffer, mouse);
|
||||||
if (p != -1) {
|
if (p != -1) {
|
||||||
|
view->carets.len = 1;
|
||||||
|
view->carets[0] = MakeCaret(p);
|
||||||
Range enclose = EncloseLoadWord(buffer, p);
|
Range enclose = EncloseLoadWord(buffer, p);
|
||||||
String16 string = GetString(*buffer, enclose);
|
String16 string = GetString(*buffer, enclose);
|
||||||
Open(string);
|
Open(string);
|
||||||
@@ -255,7 +257,8 @@ bool GlobalCommand(Event event) {
|
|||||||
|
|
||||||
Window *window = GetActiveWindow();
|
Window *window = GetActiveWindow();
|
||||||
bool mouse_in_document = CheckCollisionPointRec(mouse, window->document_rect);
|
bool mouse_in_document = CheckCollisionPointRec(mouse, window->document_rect);
|
||||||
if (mouse_in_document) {
|
bool mouse_in_line_numbers = CheckCollisionPointRec(mouse, window->line_numbers_rect);
|
||||||
|
if (mouse_in_document || mouse_in_line_numbers) {
|
||||||
View *view = GetView(window->active_view);
|
View *view = GetView(window->active_view);
|
||||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||||
DocumentSelected = window;
|
DocumentSelected = window;
|
||||||
@@ -287,7 +290,6 @@ bool GlobalCommand(Event event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Figure out scrollbar click
|
// Figure out scrollbar click
|
||||||
// @todo: probably need to refactor scrolling too :(
|
|
||||||
For(order) {
|
For(order) {
|
||||||
Window *window = &Windows[it];
|
Window *window = &Windows[it];
|
||||||
if (!window->visible) continue;
|
if (!window->visible) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user