Click multiple times to enclose load word or exec word
This commit is contained in:
@@ -424,6 +424,11 @@ Range EncloseExecWord(Buffer *buffer, Int pos) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Range EncloseLine(Buffer *buffer, Int pos) {
|
||||||
|
Range result = {GetLineStart(buffer, pos), GetLineEnd(buffer, pos)};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Int OffsetByLine(Buffer *buffer, Int pos, Int line_offset) {
|
Int OffsetByLine(Buffer *buffer, Int pos, Int line_offset) {
|
||||||
XY xy = PosToXY(*buffer, pos);
|
XY xy = PosToXY(*buffer, pos);
|
||||||
Int result = XYToPosWithoutNL(*buffer, {xy.col, xy.line + line_offset});
|
Int result = XYToPosWithoutNL(*buffer, {xy.col, xy.line + line_offset});
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ struct Event {
|
|||||||
int16_t ymouse;
|
int16_t ymouse;
|
||||||
int16_t xwindow;
|
int16_t xwindow;
|
||||||
int16_t ywindow;
|
int16_t ywindow;
|
||||||
|
uint8_t clicks;
|
||||||
struct {
|
struct {
|
||||||
uint8_t shift : 1;
|
uint8_t shift : 1;
|
||||||
uint8_t ctrl : 1;
|
uint8_t ctrl : 1;
|
||||||
uint8_t alt : 1;
|
uint8_t alt : 1;
|
||||||
uint8_t super : 1;
|
uint8_t super : 1;
|
||||||
uint8_t mouse_double_click : 1;
|
|
||||||
};
|
};
|
||||||
Vec2 wheel;
|
Vec2 wheel;
|
||||||
const char *text;
|
const char *text;
|
||||||
@@ -352,10 +352,12 @@ bool GlobalCommand(Event event) {
|
|||||||
caret.range.max = p;
|
caret.range.max = p;
|
||||||
caret.ifront = 1;
|
caret.ifront = 1;
|
||||||
}
|
}
|
||||||
} else if (event.mouse_double_click) {
|
} else if (event.clicks >= 2) {
|
||||||
view->carets.len = 1;
|
view->carets.len = 1;
|
||||||
Range range = EncloseWord(buffer, p);
|
|
||||||
if (InBounds({caret.range.min - 1, caret.range.max + 1}, p)) {
|
if (InBounds({caret.range.min - 1, caret.range.max + 1}, p)) {
|
||||||
|
Range range = EncloseWord(buffer, p);
|
||||||
|
if (event.clicks == 3) range = EncloseLoadWord(buffer, p);
|
||||||
|
if (event.clicks >= 4) range = EncloseExecWord(buffer, p);
|
||||||
caret = MakeCaret(range.max, range.min);
|
caret = MakeCaret(range.max, range.min);
|
||||||
} else {
|
} else {
|
||||||
caret = MakeCaret(p);
|
caret = MakeCaret(p);
|
||||||
|
|||||||
@@ -89,14 +89,16 @@ Event TranslateSDLEvent(SDL_Event *input_event) {
|
|||||||
event.xmouse = (int16_t)b.x;
|
event.xmouse = (int16_t)b.x;
|
||||||
event.ymouse = (int16_t)b.y;
|
event.ymouse = (int16_t)b.y;
|
||||||
if (b.button == SDL_BUTTON_LEFT) {
|
if (b.button == SDL_BUTTON_LEFT) {
|
||||||
event.kind = EVENT_MOUSE_LEFT;
|
event.kind = EVENT_MOUSE_LEFT;
|
||||||
if (b.clicks == 2) {
|
event.clicks = b.clicks;
|
||||||
event.mouse_double_click = 1;
|
|
||||||
}
|
|
||||||
} else if (b.button == SDL_BUTTON_RIGHT) {
|
} else if (b.button == SDL_BUTTON_RIGHT) {
|
||||||
event.kind = EVENT_MOUSE_RIGHT;
|
event.kind = EVENT_MOUSE_RIGHT;
|
||||||
|
event.clicks = b.clicks;
|
||||||
} else if (b.button == SDL_BUTTON_MIDDLE) {
|
} else if (b.button == SDL_BUTTON_MIDDLE) {
|
||||||
event.kind = EVENT_MOUSE_MIDDLE;
|
event.kind = EVENT_MOUSE_MIDDLE;
|
||||||
|
event.clicks = b.clicks;
|
||||||
|
} else {
|
||||||
|
event.kind = EVENT_NONE;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@@ -110,6 +112,8 @@ Event TranslateSDLEvent(SDL_Event *input_event) {
|
|||||||
event.kind = EVENT_MOUSE_RIGHT_UP;
|
event.kind = EVENT_MOUSE_RIGHT_UP;
|
||||||
} else if (b.button == SDL_BUTTON_MIDDLE) {
|
} else if (b.button == SDL_BUTTON_MIDDLE) {
|
||||||
event.kind = EVENT_MOUSE_MIDDLE_UP;
|
event.kind = EVENT_MOUSE_MIDDLE_UP;
|
||||||
|
} else {
|
||||||
|
event.kind = EVENT_NONE;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,12 @@
|
|||||||
- ctrl + delete maybe should stop on new line but it keeps on going, sublime is much more careful with deleting
|
- ctrl + delete maybe should stop on new line but it keeps on going, sublime is much more careful with deleting
|
||||||
BUG: there is a click hang when switching windows sometimes, you click after select and it doesn't switch active window
|
BUG: there is a click hang when switching windows sometimes, you click after select and it doesn't switch active window
|
||||||
|
|
||||||
|
|
||||||
- mouse execute
|
- mouse execute
|
||||||
- experiment with using multiple cursors to select command and it's input
|
- experiment with using multiple cursors to select command and it's input
|
||||||
- search as a command to execute which is going to be in the title bar
|
- search as a command to execute which is going to be in the title bar
|
||||||
- each buffer needs a directory even the special ones: C:\a\b\c\+errors?
|
- each buffer needs a directory even the special ones: C:\a\b\c\+errors?
|
||||||
- open directories - resulting in buffer with dir listing and proper buffer name
|
- open directories - resulting in buffer with dir listing and proper buffer name
|
||||||
|
|
||||||
- alt/ctrl + double click should select the exec or load word
|
|
||||||
- clean \r\n into \n on trim and load
|
- clean \r\n into \n on trim and load
|
||||||
|
|
||||||
- global config and local config
|
- global config and local config
|
||||||
|
|||||||
Reference in New Issue
Block a user