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

Minimize unnecessary cursor shifting at editor, various fixes & improvements #1839

Merged
merged 55 commits into from
Oct 16, 2022

Conversation

harshad1
Copy link
Collaborator

Am seeing this weird effect - If you put your cursor on the last line in todo.txt and open a dialog (say search) and then the dialog is dismissed (by cancel etc), the textview scrolls away from the line.

Doesn't seem to happen if we select a line which is not the last.

@harshad1
Copy link
Collaborator Author

@gsantner Not sure I will get this PR done soon. If it isn't ready by the weekend, please don't wait to release.

This is a minor issue and I will be on vacation for a week :)

@harshad1 harshad1 changed the title WIP: Minimize unnecessary shifting Minimize unnecessary shifting, other fixes Sep 26, 2022
@harshad1
Copy link
Collaborator Author

harshad1 commented Oct 7, 2022 via email

@harshad1
Copy link
Collaborator Author

harshad1 commented Oct 9, 2022

Imo this is ready to go

@@ -982,9 +983,16 @@ public String getMimeType(final Context context, String uri) {
mimeType = GsFileUtils.getMimeType(new File(uri));
}

// Detect extensions which open in this app at plain text
// Done only if all other tests fail
if (GsTextUtils.isNullOrEmpty(mimeType) && new AppSettings().init(context).isExtOpenWithThisApp(ext)) {
Copy link
Owner

Choose a reason for hiding this comment

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

Markor AppSettings shouldn't be in GsContextUtils, I will check what I can do here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess we can create an isPlainText file function somewhere in markor. But I think we have too many mime type / isTextFile functions rn, each with different semantics.

Copy link
Owner

@gsantner gsantner Oct 10, 2022

Choose a reason for hiding this comment

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

How did this check get here? I recall the ext check to be explicitley there where we do also the other extension-to-type association. At converters...and this one being in PlaintextConverter.

Btw I can also think of a other way where we need no additional extension code at utils, but still resolving works.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added it to make sure snippets and templates showed all possible files.

We could probably just move it out to the actual snippet and template logic for now

Copy link
Owner

Choose a reason for hiding this comment

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

Is FormatRegistry.isFileSupported() what you look for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that will do. Pushed the change.

I also think we should work on unifying the various mime type / file type / isTextFile functions. There are way too many now.

@gsantner
Copy link
Owner

is it ready for next check? / merge

@harshad1
Copy link
Collaborator Author

Yes. It should be done.

@harshad1
Copy link
Collaborator Author

@gsantner I have fixed the way we set default preview state here.

Current behavior is:

  • Quicknote and todo.txt open in edit mode in main activity or if launched through the dedicated shortcuts
  • If line number is specified we open in edit mode
  • If the intent specifies preview state we start in preview
  • if the file starts with "index." we start in preview

Otherwise we use the last state

@gsantner gsantner merged this pull request into gsantner:master Oct 16, 2022
gsantner added a commit that referenced this pull request Oct 16, 2022
…vements, by @harshad1, closes #1879, closes #1858 (PR #1839)

* Don't shift on resize
* Tighter syntax highlighting logic
* Rema,e TodoTxtParser -> TodoTxtTask

Co-authored-by: Gregor Santner <gsantner@mailbox.org>
@harshad1 harshad1 deleted the minimize_shifting branch October 10, 2023 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Widget: Hide dotFiles, similar to in-app filebrowser Null reference when resuming MainActivity
2 participants