terrychou / iVim

A vim port to iOS.
598 stars 35 forks source link

Cannot resize font #222

Closed KlasO closed 2 years ago

KlasO commented 2 years ago

I have tried resizing the font (advanced age in combination with poor eyes) to larger than the standard 14 points but it does not change. Have tried both pinch-zoom and :ifont set but no luck

terrychou commented 2 years ago

The pinch-zoom has been tuned somehow due to that it was too sensitive as mentioned in #141

What exact :ifont-set command have you tried?

KlasO commented 2 years ago

Pinch zoom does not work at all. I have tried ifont set and tried to change font size but when I hit Save it does not save the size change. It changes the font (if e.g. changing from Menlo to Source Code Pro). When Save is clicked, it shows a 'pop-up' in the top left corner with the fone name and size 14.0. Enabling the switch 'Update in Realtime' only results in the size parameter not being possible to change. I have also tried ifont set -s 24 that also doesn't work.

terrychou commented 2 years ago

This is weird.

Could you try to set the option 'guifont' directly like this: :set guifont=Source\ Code\ Pro:h20, then check whether it was changed successfully: :echo &guifont?

KlasO commented 2 years ago

The character size is changed when issuing :set guifont=Source\ Code\ Pro:h20.

When pinch-zooming, the font size shown when pinching - e.g. pinching to size 36 just to test results in echoed Source Code Pro:h36.0 but the screen font size stays at 22.

EDIT: Manual workaround for now is to add :set guifont=Source\ Code\ Pro:h24 in .vimrc

arnoro commented 2 years ago

I have the same problem.

terrychou commented 2 years ago

@KlasO I have made some changes concerning this issue and pushed it to TestFlight. It should be available soon. Please give it a try to see whether it solves this problem.

KlasO commented 2 years ago

@terrychou I just downloaded and tested 2.46(1)

terrychou commented 2 years ago

@KlasO Please tell me the value of 'guifont' (via :echo &guifont) after each attempt (:ifont set or GUI way) to change the size.

Also, after a failure, try and run :redraw! to see what happens.

KlasO commented 2 years ago

@terrychou After pinch-zoom: :echo &guifont results in Menlo:h34.0; issuing :redraw! makes no difference either to font size or echo result After :ifont set: :echo &guifont shows Source Code Pro:h20.0:b:1 (yes, I picked another font name as well) but no change in the displayed font. :redraw!makes no difference.

terrychou commented 2 years ago

@KlasO do you mean that the value of option 'guifont' did change to the target size, e.g. ":h34.0", ":h20.0" in the above examples but the displayed font never change, i.e. it stays 14.0?

KlasO commented 2 years ago

@terrychou Correct, the variable changes but the screen font size does not change.

terrychou commented 2 years ago

@KlasO there is a strange part :b:1 in your example. Are you using any plugins? Could you disable them to see whether it is different?

I have made some more changes against this issue according to our discussion so far and pushed it (2.46(2)) to TestFlight. Please give it a try.

KlasO commented 2 years ago

@terrychou I have:

terrychou commented 2 years ago

@KlasO the problem to me is that I cannot reproduce this issue at my end (on device or in simulators). Therefore I can only guess what may be the cause but I haven't got it so far obviously.

Could you make a screen recording of you reproducing all these operations on your device? So that I could have more intuitive ideas and may get some hints from it. (Here is how to screen recording on your device: https://support.apple.com/en-us/HT207935)

KlasO commented 2 years ago

@terrychou attached please find screen recording per your request https://user-images.githubusercontent.com/26037930/147824600-fd927fba-b260-471b-9297-0bbe620d643a.mp4

terrychou commented 2 years ago

@KlasO did you have this issue with the old font management system (prior to version 2.45)? If you are not sure, you can have a try in TestFlight and install a build of version 2.44 from "Previous Builds".

KlasO commented 2 years ago

@terrychou Going back to 2.44(1) pinch-zoom unfortunately doesn't work either. :ifont set 1 24 does work though.

I don't recall exactly how I had it set up before 2.45 (I had probably issued something like :ifont set 4 24 and it stuck from session to session), but as far as I can tell, I detected the issue when installing 2.45 and the screen font was suddenly 14pt (and ifont set no longer working).

terrychou commented 2 years ago

@KlasO I have made some changes to the font set command according to your comparison between the old and new system, and pushed version 2.46(3) to TestFlight. Please give it a try.

KlasO commented 2 years ago

@terrychou I tried the 2.46/3) but neither ifont set and save from the gui nor pinch-zoom works. Set guifont still works.

terrychou commented 2 years ago

@KlasO please tell me more details.

What exact font set command did you execute? Did they change the option 'guifont' values successfully? What were they? Can they change the font?

Also, do you enable notifications in iVim? If not, please enable it since the font management would notify you with useful information.

After each font (or size) change attempt, please open the font settings view again and tell me the readings in it.

Also, if the size failed to change, please issue a command :redraw! (maybe make several in a row) to see what happens.

KlasO commented 2 years ago

@terrychou I don't work as a software tester, but I still try to be methodical so I've done the same thing when testing. (I can't vouch for having done the exact same steps, in the exact same order each time, but again, I'm don't work with software testing).

1) Open iVim and comment out set guifont=Source\ Code\ Pro:h24in ~/.vimrc; save and :q

2) echo &guifont; result= "Source Code Pro: h24 3) Reload iVim; result: font in 14pt 4) Try to increase font by pinch-zooming; the bubble in the top left corner showsSource Code Pro: 24.0, and when release the fingers, no change, ie still 14pt. 5)echo &guifontresults in Source Code Pro:h36.0 shown on the message line 6):redraw!issued two times - no change; 7)ifont setwithout parameters; GUI dialogue; change to 24pt and click Save; no change, still 14pt 8)echo &guifontresults in Source Code Pro:h24.0:b:1 9):redraw!issued two times - no change; ie still 14pt. and &guifont still shows Source Code Pro:h24.0:b:1 Throughout these steps, I have checked the:ifont set` dialogue, and the only change that takes effect is changing the typeface, e.g. from Source Code Pro to Menlo; see attachment. IMG_0197

terrychou commented 2 years ago

@KlasO thanks for the details. According to them, I have rewritten the UI font updating part and pushed it (2.46(4)) to TestFlight. Please have a look.

KlasO commented 2 years ago

@terrychou unfortunately no success,

  1. Update to latest test build
  2. Open iVim
  3. Pinch-zoom to change font - doesn’t work
  4. Comment out the set guifont part and restart iVim
  5. Pinch-zoom, doesn’t work
  6. :echo &guifont - Source Code Pro:h35.0 is shown
  7. :redraw! twice - no change, and still shows Source Code Pro:h35.0
  8. :Ifont set
  9. Change font to Menlo and size to 24pt, Save, changes typeface but not font size
  10. :redraw! twice, no change
terrychou commented 2 years ago

@KlasO could you try and open iVim without loading anything like this?:

  1. quit iVim by issuing :qa first;
  2. then open Settings.app and in iVim's section, input -u NONE into "Arguments";
  3. then tap iVim to launch it;
  4. then try the font settings to see whether something new happens.
KlasO commented 2 years ago

@terrychou certainly, tried that and still no luck. I tried both pinch-zoom and ifont set but only thing that works is changing the typeface, i.e. from Source Code Pro to Menlo.

terrychou commented 2 years ago

@KlasO does the :set guifont=... work in this build?

I have some ideas:

  1. Do you have another device to test this?
  2. Can you afford to reinstall iVim? I mean delete iVim from your device first then install it from TestFlight again. You can backup your documents beforehand via the Files.app though (use the external command tar to tarball your documents and move the tarball to somewhere else in the Files.app). If it is too risky to you, just never mind.
KlasO commented 2 years ago

@terrychou :set guifontworks 1) I did test an earlier build on an iPad mini where I had no previous installation of iVim, but does not work. 2) Certainly, I deleted the app and installed fresh from TestFlight Test results:
t1) pinch zoom, does not change screen font size, echo &guifont shows the pt size after the pinch-zoom, redraw! makes no difference.
t2) :ifont setand change font in the GUI does not change screen font size, echo &guifont shows the pt size after the GUI Save, this time with :b:i appended. :redraw!makes no difference.

KlasO commented 2 years ago

@terrychou Unsure if it makes a difference, but I stumbled upon it: I can use :set guifont=Menlo:h24 and that works, but when I tried :set guifont=Menlo:h24.0 it does NOT work. I don't know why I tried, but the bubble after pinch-zoom shows the pt size as a float (e.g. 24.0) whereas the only working way of :set guifont seems to be an integer.

terrychou commented 2 years ago

@KlasO this is interesting. I will have a look at the code again to see what I can do.

terrychou commented 2 years ago

@KlasO I have made some more changes concerning this issue and pushed it (2.46(5)) to TestFlight, please do the following:

First, please ensure that:

Then do the following testings:

For each above attempt, if the size failed to change as expected, please record the following info and let me know:

Also let me know any notifications come up during the testing.

KlasO commented 2 years ago

@terrychou below please find my test results. On a side note (and a true first-world problem), it is very inconvenient that it isn't possible to copy text from the screen when documenting echo results such as now.

Tests :ifont +

:ifont -

:ifont set me* -s 20

:ifont set -s 40

:ifont set increase size, not realtime

:ifont set increase size, realtime enabled ,

terrychou commented 2 years ago

@KlasO Please try the following:

  1. Create a key mapping to call :set guifont=..., then invoke the shortcut to see whether it works;
  2. try :set guifont=Menlo:h16.6 to see if it works.
KlasO commented 2 years ago

@terrychou 1) please provide the exact mapping you want me to test 2) Does not work, font bubble says 'Menlo: 14.0', and if the command is repeated, no bubble is shown

terrychou commented 2 years ago

@KlasO for example, you said the :set guifont=... is working, right?

So, please make a keyboard shortcut like this :nmap ,d :set guifont=Source\ Code\ Pro:h20<CR>. Then invoke it in normal mode with shortcut ,d. See whether it works.

KlasO commented 2 years ago

@terrychou I issued :nmap ,d :set guifont=Source\ Code\ Pro:h20<CR> and subsequently hit ,d and it works. The result is that the screen font is changed to Source Code Pro 20pt (which is wasn't before the command).

terrychou commented 2 years ago

@KlasO I have pushed version 2.46(6) to the TestFlight, please give it a try.

No matter it works or not, please do the following:

  1. try set the font with :set guifont=Source\ Code\ Pro:h16.6;
  2. then print the value :echo g:ivim_font_size_debug and tell me.
KlasO commented 2 years ago

@terrychou It seems to work, font is changed, and the font bubble shows 'Source Code Pro:h 16.0 :echo g:ivim_font_size_debug displays 'none' Edit: Pinch-zoom seems to work as well.

terrychou commented 2 years ago

@KlasO build 2.46(7) is ready. It should solve this problem completely. You should now be able to set a font size with decimal part, e.g. :set guifont=Source\ Code\ Pro:h18.6. Please have a look.

P.S. it turns out that this problem is caused by the system locale (Yours doesn't think the dot "." is part of a number.)

KlasO commented 2 years ago

@terrychou I'm sorry to say that although the font resizing seems to work, the app crashes when I reopen it. I hit submit when asked if I'd like to share with the dev.

Edit: when it crashed, I deleted and reinstalled, and when that was done, I saved my .vimrc.

terrychou commented 2 years ago

@KlasO what about now? which version are you using? does it still crash?

I have seen your crash report. It crashed when it was trying to load startup scripts. Was your .vimrc enabled when it crashed?

KlasO commented 2 years ago

@terrychou I just reinstalled the most recent Testflight build, added my .vimrc and after that, it hangs again :(

EDIT: After that, I reinstalled the App Store version, but it still hangs. Deleting the app, and reinstalling the App Store version, and adding my .vimrc still makes the app hang.

terrychou commented 2 years ago

@KlasO try and turn "Auto-restore" off of iVim in the Settings.app to see whether it helps.

Also, I have removed the total locale factor and pushed 2.46(8) to TestFlight. Please give it a try.

KlasO commented 2 years ago

@terrychou 1) Install 2.46(8) (fresh install - no other version installed) 2) disable auto-restore 3) Paste .vimrc lines 4) :w .vimrc 5) :q and restart - hangs I have submitted two crash dumps

terrychou commented 2 years ago

@KlasO can I have a look at the content of your .vimrc? The crashes seemed caused by loading it... (Please send it to me via email if you care about the privacy.)

KlasO commented 2 years ago

@terrychou Please have a look here: https://github.com/KlasO/vimrc/blob/main/.vimrc

terrychou commented 2 years ago

@KlasO this is a bug concerning external commands execution in scripts. I have fixed it and pushed it (2.46(9)) to TestFlight. Please give it a try.

KlasO commented 2 years ago

@terrychou I have downloaded the new build and run a few tests, and all things I have tested work just fine. (Pinch-zoom, various :ifont set, adding my .vimrc, and edited some files. I am happy with this build :)

terrychou commented 2 years ago

@KlasO Great! Thanks for helping and patience. I will release it soon.