Simplify mouse left

This commit is contained in:
Krzosa Karol
2024-08-09 07:50:03 +02:00
parent 93530bd089
commit 91ba202562
2 changed files with 6 additions and 32 deletions

View File

@@ -317,37 +317,11 @@ bool GlobalCommand(Event event) {
caret.range.max = p;
caret.ifront = 1;
}
} else if (event.clicks >= 2) {
} else if (event.clicks >= 2 && InBounds({caret.range.min - 1, caret.range.max + 1}, p)) {
view->carets.len = 1;
// @todo: consider simplifying this, is enclosing a paren even useful?
// like it's pretty hard to actually hit with mouse...
if (InBounds({caret.range.min - 1, caret.range.max + 1}, p)) {
Range range = EncloseWord(buffer, p);
wchar_t scope = GetChar(buffer, p);
if (!IsParen(scope) && !IsBrace(scope)) {
scope = GetChar(buffer, p);
}
if (IsBrace(scope)) {
range = EncloseScope(buffer, p, '{', '}');
} else if (IsParen(scope)) {
range = EncloseScope(buffer, p, '(', ')');
} else {
if (event.clicks == 3) {
Range load_word_range = EncloseLoadWord(buffer, p);
if (AreEqual(load_word_range, range)) {
load_word_range = EncloseFullLine(buffer, p);
}
range = load_word_range;
}
if (event.clicks >= 4) range = EncloseFullLine(buffer, p);
}
caret = MakeCaret(range.max, range.min);
} else {
caret = MakeCaret(p);
}
Range range = EncloseWord(buffer, p);
if (event.clicks >= 3) range = EncloseLoadWord(buffer, p);
caret = MakeCaret(range.max, range.min);
} else {
view->carets.len = 1;
caret = MakeCaret(p);

View File

@@ -1,6 +1,6 @@
- Remove pointers and use ViewIDs (enable array debug while doing this)
- try using git grep for search for now, combine with fuzzy search buffer
- need to rewrite the path matching in lua
- lua maybe try heuristic matching paths from left?
- prevent lua from infinite looping
- Append to console and change console directory
- win32: change all stack buffers to arena
@@ -8,7 +8,6 @@
- search as a command to execute which is going to be in the title bar
- search backwards
- braces enclose should be performed even if we put the mouse out of bounds!
- select until
- some split selection commands
- assign commands or lua functions to F1-F12 keys
@@ -47,6 +46,7 @@ BUG: there is a click hang when switching windows sometimes, you click after sel
backlog
- expose a coroutine based scripting enviorment where user can execute shell commands wait for them and perform actions in very linear manner
- Test stdin writing code
- Implement shell interaction (last line should have a '$'' symbols, if you press enter it should send that line to stdin of a running shell)
- drop text into window