Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jeremypw
Copy link
Collaborator

Fixes #1191
Fixes #1193

  • Use native Gtk.SourceView DnD handling for buffer contents;
  • Handle DnD of uri lists with DocumentView

The linked issues are caused by resetting the source view as a drag destination to handle uri lists but without handling text properly. Attempts were made to handle uris with the sourceview without causing issues for buffer contents but these failed. It is much easier to keep the native DnD handling of the Gtk.SourceView and handle uri lists with the DocumentView.

The effect of this change is that in order to create a new document by dropping a file item (e.g. from Files) the target is the "Add Tab" button on the tab bar. Dropping elsewhere (e.g. on the textview) drops the uri as text.

In my opinion, this change is acceptable, despite the smaller target for uris, since (1) Dropping a file onto a sourceview has an ambiguous intent (drop uri as text? drop file contents as text? create new document???) and (2) it is not likely to be a commonly used action anyway.

Jeremy Wootten added 2 commits May 13, 2022 18:56
* Use native Gtk.SourceView DnD handling for buffer contents;
* Handle DnD of uri lists with DocumentView
@jeremypw jeremypw requested a review from a team June 7, 2022 18:33
Copy link
Contributor

@zeebok zeebok left a comment

Choose a reason for hiding this comment

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

Code looks good and works as described. My only thought with testing is maybe also open the file in a new tab if the file is dropped anywhere in the tab area instead of only the new document button.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jun 9, 2022

@zeebok Thanks for the review! I'll look into your suggestion in a separate PR.

@jeremypw jeremypw merged commit 1ed7b59 into master Jun 9, 2022
@jeremypw jeremypw deleted the fix-drag-accented branch June 9, 2022 07:20
@jeremypw
Copy link
Collaborator Author

jeremypw commented Jun 9, 2022

@zeebok Actually, you can also drop files onto the blank area of the tabbar to create a tab with this PR. Changes would have to be made to the Granite library to implement dropping onto an existing tab (and it is not clear what the expected behaviour would be in that case). As Granite DynamicNotebook is likely to be replaced in the not too distant future I do not think it worth progressing this further.

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.

Dragging text into document in a second window duplicates it Drag and drop of selected text not working with accented characters

3 participants