Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addons/markword: Deselect when the selection changes #614

Merged
merged 2 commits into from Oct 10, 2017

Conversation

gkatev
Copy link
Contributor

@gkatev gkatev commented Oct 4, 2017

Not sure if desired or not, but the marked results currently do not clear when the selected text is modified/deleted. The modification detects the deletion and clears the markers. Only works when single-click deselect is enabled.

Copy link
Member

@eht16 eht16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and seems reasonable, except for the comment.

@@ -190,6 +208,14 @@ void ao_mark_document_open(AoMarkWord *mw, GeanyDocument *document)
FALSE,
G_CALLBACK(on_editor_button_press_event),
mw);

plugin_signal_connect(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong place for the signal connect.
Here we connect to the signal on each opened document but never disconnect from it.

It would be better to re-use the already existing signal callback ao_editor_notify_cb in addons.c and add there a call to on_editor_notify after making it public.

Copy link
Member

@eht16 eht16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine now.
If you don't mind, it would be cool to squash the commits together (maybe the first three and keep the last one seperate or alltogether, as you like).

Added a hook to clear the markers when the current selection is
changed (eg. text was deleted, replaced etc). This will only take
effect if 'single click deselect' is enabled in the preferences.
Problem: when text is highlighted, using the arrow keys will move the
cursor outside the selection, without clearing it

Feature added: listen for cursor movements and if there is no active
selection(selection, not highlighting), clear the markers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants