feat(code): improve comment toggling, terminal navigation, and editor event wiring
- Refactor Commenter toggle logic for line and multi-line comments - Preserve indentation and cursor position - Improve handling of existing comment detection and removal - Simplify bounds vs line comment dispatch - Enhance terminal project navigation - Add project marker detection via Gio file traversal - Implement go-to-project-or-home behavior (Home key shortcut) - Automatically `cd` into detected project root or home directory - Wire terminal widget navigation through VteWidget - Improve terminal integration - Pass emit_to into terminals view for event dispatching - Add ability for VteWidget to trigger project navigation - Update split pane shortcut - Change close split view binding to Alt+\ - Add editor event support - Emit `text_insert` event from SourceFile on insert - Add new TextInsertEvent DTO and register in event system - Misc cleanup - Improve imports and structure in terminals module - Add project marker list and filesystem traversal helpers
This commit is contained in:
@@ -61,7 +61,20 @@ class SourceFile(GtkSource.File):
|
||||
location: Gtk.TextIter,
|
||||
text: str, length: int
|
||||
):
|
||||
...
|
||||
event = Event_Factory.create_event(
|
||||
"text_insert",
|
||||
file = self,
|
||||
buffer = self.buffer,
|
||||
location = location,
|
||||
text = text,
|
||||
length = length
|
||||
)
|
||||
|
||||
# Note: 'idle_add' needed b/c markers don't get thir positions
|
||||
# updated relative to the initial insert.
|
||||
# If not used, seg faults galor during multi insert.
|
||||
# GLib.idle_add(self.emit, event)
|
||||
self.emit(event)
|
||||
|
||||
def _after_insert_text(
|
||||
self,
|
||||
|
||||
@@ -29,6 +29,7 @@ from .cursor_moved_event import CursorMovedEvent
|
||||
from .delete_range_event import DeleteRangeEvent
|
||||
from .modified_changed_event import ModifiedChangedEvent
|
||||
from .text_changed_event import TextChangedEvent
|
||||
from .text_insert_event import TextInsertEvent
|
||||
from .text_inserted_event import TextInsertedEvent
|
||||
from .focused_view_event import FocusedViewEvent
|
||||
from .set_active_file_event import SetActiveFileEvent
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Python imports
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
|
||||
gi.require_version('Gtk', '3.0')
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
# Application imports
|
||||
from .code_event import CodeEvent
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextInsertEvent(CodeEvent):
|
||||
location: Gtk.TextIter = None
|
||||
text: str = ""
|
||||
length: int = 0
|
||||
Reference in New Issue
Block a user