markor icon indicating copy to clipboard operation
markor copied to clipboard

WIP: Minimize unnecessary shifting

Open harshad1 opened this issue 2 years ago • 1 comments

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 avatar Sep 10 '22 07:09 harshad1

@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 avatar Sep 10 '22 07:09 harshad1

Thanks, yes, I noticed. I am trying to make sure the behaviour matches what is desired. I think the behavior as implemented now in this PR is actually correct. But I am continuing to test.

Sep. 28, 2022 11:29:14 Gregor Santner @.***>:

@.**** commented on this pull request.


In app/src/main/java/net/gsantner/opoc/format/GsTextUtils.java[https://github.com/gsantner/markor/pull/1839#discussion_r982736838]:

@@ -163,17 +164,6 @@ public static int tryParseInt(final String value, int defaultValue) { } }

  • public static <T> ArrayList<T> toArrayList(T... array) {
  •    ArrayList<T> list = new ArrayList<>();
    
  •    Collections.addAll(list, array);
    
  •    return list;
    
  • }
  • // Not null, not empty, not spaces only
  • public static boolean ne(final String str) {
  •    return str != null && !str.trim().isEmpty();
    

some issues may come out of simple exchange of it. ne is the opposite.

— Reply to this email directly, view it on GitHub[https://github.com/gsantner/markor/pull/1839#discussion_r982736838], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAOZ3TB3A2OCMJZULD4Y3ZTWASE7TANCNFSM6AAAAAAQJGZZGY]. You are receiving this because you authored the thread.[Tracking image][https://github.com/notifications/beacon/AAOZ3TDD2G3TMYUNETY4HBTWASE7TA5CNFSM6AAAAAAQJGZZG2WGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTSDAGNS2.gif]

harshad1 avatar Sep 28 '22 18:09 harshad1

Can I push something to this PR now, is that a problem? Related to text empty,mime

gsantner avatar Sep 28 '22 18:09 gsantner

I push something to master, should be not that hard to merge. My point is, the TextViewUtil method has a rather different use/background then whats needed there. So while at edittext-text saving we need something to check if there is really text, or only whitespace. But for other generic "text not null, text not empty" checks the "not contains any whitespace character" is rather something different, so lets keep it separatley.

gsantner avatar Sep 28 '22 19:09 gsantner

Go for it.

It's become a staging / testing pr for a bunch of different changes anyway

Sep. 28, 2022 11:51:19 Gregor Santner @.***>:

Can I push something to this PR now, is that a problem?

— Reply to this email directly, view it on GitHub[https://github.com/gsantner/markor/pull/1839#issuecomment-1261331205], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAOZ3THJOGSBICG6MMWDP6DWASHSLANCNFSM6AAAAAAQJGZZGY]. You are receiving this because you were assigned.[Tracking image][https://github.com/notifications/beacon/AAOZ3TBDIAAP5L7JGWB5VPLWASHSLA5CNFSM6AAAAAAQJGZZG2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSLFZRQK.gif]

harshad1 avatar Sep 28 '22 19:09 harshad1

I got a mail that there is for some user a problem with the Undo-Redo buttons and that the app crashes. Didn't run in to it yet, but now the first time saw it.

It's this one here:

Screenshot_20220928-235251

I would just add a line _helper = (helper != null ? helper : new TextViewUndoRedo() above that line.

Do you think thats good enough?

gsantner avatar Sep 28 '22 21:09 gsantner

You need to know, that also the top toolbar button for favorites, at the end does nothing more then set current directory to that virtual path. Ans whenever that path is detected, everything using filebrowser loads from appsettings instead of from listFiles.

Am 5. Oktober 2022 23:19:14 MESZ schrieb Harshad Vedartham @.***>:

Wow lol. Maybe we should make this more discoverable >

gsantner avatar Oct 05 '22 21:10 gsantner

I have the file with the long line and my test files. All work satisfactorily.

H

Oct. 7, 2022 11:25:03 Gregor Santner @.***>:

@.**** commented on this pull request.


In app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java[https://github.com/gsantner/markor/pull/1839#discussion_r990395185]:

             final int[] newHlRegion = hlRegion(_hlRect); // Compute this _before_ clear
  •            try {
    
  •                beginBatchEdit();
    
  •                blockBringPointIntoView(); // Hack to block bring point into view
    

do you need some testfiles again or do you have it all around?

— Reply to this email directly, view it on GitHub[https://github.com/gsantner/markor/pull/1839#discussion_r990395185], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAOZ3TDAEUTPFDRQ3ZFOQFDWCBTH5ANCNFSM6AAAAAAQJGZZGY]. You are receiving this because you were mentioned.[Tracking image][https://github.com/notifications/beacon/AAOZ3TG37ENERH3LENDKHETWCBTH5A5CNFSM6AAAAAAQJGZZG2WGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTSDUWJRC.gif]

harshad1 avatar Oct 07 '22 20:10 harshad1

Imo this is ready to go

harshad1 avatar Oct 09 '22 01:10 harshad1

is it ready for next check? / merge

gsantner avatar Oct 12 '22 19:10 gsantner

Yes. It should be done.

harshad1 avatar Oct 12 '22 20:10 harshad1

@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

harshad1 avatar Oct 13 '22 18:10 harshad1