-
Notifications
You must be signed in to change notification settings - Fork 345
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
BUGFIX: Headline dialog and file detection #2300
BUGFIX: Headline dialog and file detection #2300
Conversation
@@ -88,41 +91,29 @@ public static class Format { | |||
} | |||
} | |||
|
|||
public static final Format[] FORMATS = new Format[]{ | |||
// Order here is used to **determine** format by it's file extension and/or content heading | |||
public static final List<Format> FORMATS = Arrays.asList( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordered so that the detection happens correctly
@@ -41,7 +41,7 @@ public class MarkdownActionButtons extends ActionButtonBase { | |||
|
|||
private static final Pattern WEB_URL = Pattern.compile("https?://[^\\s/$.?#].[^\\s]*"); | |||
|
|||
private final Set<Integer> _disabledHeadings = new HashSet<>(); | |||
private final MarkorDialogFactory.HeadlineDialogState _headlineDialogState = new MarkorDialogFactory.HeadlineDialogState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guanglinn Instead of inserting arbitrary data into the intent, we create and pass around a state class for the headline dialog
public static class HeadlineDialogState { | ||
public Set<Integer> disabledLevels = new HashSet<>(); | ||
public String searchQuery = ""; | ||
public int listPosition = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guanglinn Headline dialogs remember their position, query and the currently enabled levels
FormatRegistry.FORMAT_ASCIIDOC, | ||
FormatRegistry.FORMAT_ORGMODE, | ||
FormatRegistry.FORMAT_CSV | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only these types are available in new file dialog
dialogBuilder.setOnDismissListener((dialogInterface) -> { | ||
// Update state | ||
dopt.listPosition = listView.getFirstVisiblePosition(); | ||
dopt.defaultText = searchEditText.getText().toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update dopt with the value when closed.
This should address #2297 |
@guanglinn Please test this PR and see if the headline dialog works as expected I will likely make further changes in the future |
@harshad1 OK, I will test this PR in time. If any unexpected behaviors are found, I will tell you. |
…ad1/markor into headline_dialog_and_file_detection
@harshad1 Nothing unexpected are found yet, I think it is fine. |
@gsantner I think this is good enough to go if you want to merge these fixes in. I want to make further improvements to the headline dialog among other things but I can do that in a follow up PR. |
Thank you for your time. I want to check/release it on the weekend.
Am 24. Mai 2024 22:55:34 MESZ schrieb Harshad Vedartham ***@***.***>:
…
@gsantner I think this is good enough to go if you want to merge these fixes in.
I want to make further improvements to the headline dialog among other things but I can do that in a follow up PR.
--
Reply to this email directly or view it on GitHub:
#2300 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
CONVERTER_EMBEDBINARY, | ||
CONVERTER_ORGMODE, | ||
}; | ||
new Format(FormatRegistry.FORMAT_ORGMODE, R.string.orgmode, ".org", CONVERTER_ORGMODE), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effective this is also the check order. To my understanding the last 3 have to be in order EMBEDBINARY,PLAIN,NONE, and everything else above. OrgMode is currently detected as PLAINTEXT as far I understand.
I have also had ideas to improve the headline dialog. For example, toc_in_dialog.mp4 |
In this PR I make 2 changes: