Added mouse zoom; fixed colorize bug; set default line to 0

This commit is contained in:
itdominator 2023-10-14 15:44:45 -05:00
parent eb149270b0
commit 3ad7c3b65d
5 changed files with 33 additions and 4 deletions

View File

@ -72,7 +72,7 @@ class Plugin(PluginBase):
start = iter.copy()
for tag in tags:
if self.tag_stub_name in tag.props.name:
if tag.props.name and self.tag_stub_name in tag.props.name:
buffer.remove_tag(tag, start, end)
tag_table.remove(tag)

View File

@ -75,7 +75,7 @@ class FileEventsMixin:
self.update_labels(gfile)
self._loading_file = False
self._file_loader.load_async(io_priority = 70,
self._file_loader.load_async(io_priority = 80,
cancellable = None,
progress_callback = None,
progress_callback_data = None,

View File

@ -82,6 +82,7 @@ class SourceView(SourceViewEventsMixin, GtkSource.View):
self.connect("drag-data-received", self._on_drag_data_received)
self.connect("key-press-event", self._key_press_event)
self.connect("button-press-event", self._button_press_event)
self.connect("scroll-event", self._scroll_event)
self._buffer.connect('changed', self._is_modified)
self._buffer.connect("mark-set", self._on_cursor_move)
@ -180,6 +181,29 @@ class SourceView(SourceViewEventsMixin, GtkSource.View):
elif eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 3: # r-click
...
def _scroll_event(self, widget, eve):
accel_mask = Gtk.accelerator_get_default_mod_mask()
x, y, z = eve.get_scroll_deltas()
if eve.state & accel_mask == Gdk.ModifierType.CONTROL_MASK:
if z > 0:
self.scale_down_text()
else:
self.scale_up_text()
return True
if eve.state & accel_mask == Gdk.ModifierType.SHIFT_MASK:
adjustment = self.get_hadjustment()
current_val = adjustment.get_value()
step_val = adjustment.get_step_increment()
if z > 0: # NOTE: scroll left
adjustment.set_value(current_val - step_val * 2)
else: # NOTE: scroll right
adjustment.set_value(current_val + step_val * 2)
return True
def _focus_in_event(self, widget, eve = None):
event_system.emit("set_active_src_view", (self,))
self.get_parent().get_parent().is_editor_focused = True

View File

@ -64,7 +64,7 @@ class SourceViewEventsMixin(MarkEventsMixin, FileEventsMixin):
event_system.emit("set_line_char_label", (f"{row}:{col}",))
def got_to_line(self, line: int = 0):
index = line - 1
index = line
buffer = self.get_buffer()
line_itr = buffer.get_iter_at_line(index)
char_iter = buffer.get_iter_at_line_offset(index, line_itr.get_bytes_in_line())

View File

@ -39,7 +39,7 @@ notebook > header > tabs > tab {
}
notebook > header > tabs > tab:active {
background: rgba(39, 43, 52, 0.0);
background: rgba(0, 0, 0, 0.0);
}
@ -223,3 +223,8 @@ popover {
.px97 { font-size: 97px; }
.px98 { font-size: 98px; }
.px99 { font-size: 99px; }
.mini-view > text {
background: rgba(39, 43, 52, 0.64);
}