The app doesn't continue where I left when I switch between editor and preview mode.
What problem would this solve?
- I use table of contents on the left (but the problem is also same without table of contents menu too.), and I use the app continuously by switching back and forth between two modes.
- No split view, I switch modes by using "ctrl+e" shortcut.
- When switch back to the editor mode, the app always goes to below of the page.
- When switch back to the preview mode, the app goes to the beginning.
- I just want it to stay in the line where I left my cursor when I switch modes by using the
ctrl+eshortcut.
I'm really curious about the next update! 👀
- With the new release (2.8.0), this issue has been changed, but it doesn't work as intended. Let me explain it briefly.
- I'm writing in the middle of the page in editor mode, then I press
ctrl+eto go back to preview mode and the app stays where I left (although it's not smooth, this it could be more precise and smoother in the next relases or patches idk.); that's, this issue seems nearly fixed, but it's not. When I want to go back to editor mode again, the app always goes to the end of the page. Every time, no exception. - Additionally, when you switch between these two modes, the app goes crazy. It changes where I left automatically and moves randomly.
- Also, during this switching process, table of contents doesn't work properly.
- I'm writing in the middle of the page in editor mode, then I press
- It would be great to take a look at it again. Thanks in advance.
Thanks for the detailed follow-up — I was able to reproduce this on Windows.
It looks like it only happens when scroll sync is turned on for the tab. Sync can only be toggled from split view, but it stays active after you leave split view, and in single-pane mode it pulls the editor to a wrong (always later) position whenever you switch with Ctrl+E. Repeated switching walks it towards the end of the document.
Could you check one thing: open split view (Ctrl+\) and see whether the scroll sync button (the link icon in the title bar) is highlighted? If it is, turning it off should make Ctrl+E land on the right line in both directions — please let me know if it does.
The table of contents highlight is a separate bug: after switching, it keeps showing the heading from before the switch until you scroll. That happens with sync off too.
I'll look into a fix for both.
Yes, I've checked sync button was highlighted, and I've turned it off and tested it again, but the problem hasn't changed. It's still same.
- I'm on the editor mode, and first
ctrl+elooks good, it lands on the same line nearly (it goes one or two lines below), but after that, allctrl+egoes a bit more down the line. - I think it's because each
ctrl+edoesn't land at the exact line; it's same on the first try too. - My fonts and their sizes are same on both editor and preview mode, so the problem is not about that, I guess.
- Also, I think table of contents should follow the cursor, not the first line of the visible page.
Thanks for checking. #887 (now merged) stops sync from running outside split view and fixes the outline after Ctrl+E. Could you try a build with it?
- Download
app-bundle-windowsfrom the bottom of this page (you need to be signed in to GitHub): https://github.com/sftwrdotdev/Markpad/actions/runs/36438295927 - Unzip it. Inside is a single
.exe; there is nothing to install, and it uses your existing settings. - Fully close your installed Markpad first. Only one copy of Markpad runs at a time, so otherwise the test build would just switch to the window you already have open.
The small drift you describe, a line or two further down on every Ctrl+E, has a separate cause that this build does not fix yet. The editor was created with the default font size and wrapping, and your zoom level or a proportional editor font (like Roboto) was applied just after the position was placed. So the same pixel offset pointed at a later line each time. A fix for that is next. To confirm it's your case: is your zoom level something other than 100%, and which editor font do you use?
Following the cursor in the outline is a good idea too; we're looking at how it should behave.
- This is the version you just sent. The problem is same and there is no any additional zoom.
- Font: Roboto Slab, size 15; both on editor and preview mode.
https://github.com/user-attachments/assets/34d38f55-7319-475c-af31-b8baefb255a3
Thanks, that confirms it. The build I sent before only had #887, which fixes the jump to the bottom of the page. It didn't include the fix for the drift you're seeing.
Roboto Slab is a proportional font, and that is exactly the case #889 fixes. The editor applied the wrapping for a proportional font just after the position was placed, so each Ctrl+E landed a bit lower.
Could you try this newer build? It has both #889 and #890: https://github.com/sftwrdotdev/Markpad/actions/runs/36447451979 (same steps as before, app-bundle-windows).
Two things to test:
- Drift. With Roboto Slab, does
Ctrl+Eback and forth now keep you on the same line, instead of creeping down each time? - Outline following the cursor. This is new in #890. Go to Settings → Editor → "Table of Contents Highlights" and choose "Cursor Line". While the editor is on screen, the outline then follows the cursor instead of the scroll position. If the cursor is off screen when you press
Ctrl+Einto the editor, it moves onto the page, so the outline matches what you see. The preview on its own has no cursor, so there it still follows the scroll.
- Yes! It works well now, thank you.
The preview on its own has no cursor, so there it still follows the scroll.
- Can you find a workaround for this? Idk, maybe an invisible cursor that is sync with the editor mode's cursor, so this also fixes the movement on the table of contents view.
- I've just installed a lightweight recorder app just because of this issue btw :)
https://github.com/user-attachments/assets/7510d2f0-65f7-4cb4-9ccd-a72ea11f7327
Glad the drift is fixed, thanks for testing (and for the recordings).
An invisible cursor in the preview can work two ways. Which one do you want?
- The preview keeps the editor's cursor. The outline stays on the heading where you left the cursor in the editor. Scrolling the preview doesn't move it, and nothing in the preview moves it either. It changes only when you move the cursor in the editor.
- A click in the preview places the cursor. Clicking on text in the preview moves the invisible cursor to that line, and the outline follows it. Scrolling alone doesn't move it, same as in the editor. When you press
Ctrl+E, the editor's cursor is on the line you clicked. This is closer to how Typora feels, where clicking on the rendered text places the cursor.
A correction to option 2: the cursor wouldn't be invisible. You need to see where you clicked. Here's how it would work:
- Where it lands. A click places it on the exact character, not just the paragraph. In plain text, bold, italics, links and inline code it's precise. For things that don't map back to the source character by character, like math and images, it goes to the start of that element.
- How it looks. Like the editor's cursor, so you can tell it's the same one: a thin vertical line plus a faint highlight on the current line. It doesn't blink, which shows the preview isn't editable. The line highlight follows the editor's "Line Highlight" setting.
- What it does. The outline follows it.
Ctrl+Eputs the editor's cursor on the same character. Selecting text by dragging works as before. - When it's there. Only with "Table of Contents Highlights" set to "Cursor Line". With "Scroll Position", the preview has no cursor, same as now.
Let us know whether you'd prefer this (2) or keeping the editor's cursor (1).
- I've just tested it, and actually preview mode follows the cursor, but you have to click on a line in preview mode too. When I wrote the comment above, I haven't clicked anywhere in preview, I've just scrolled and it didn't follow while switching, but if you click (also selecting words works but not exactly, I'll add a video below and you'll understand easily what I mean.) on a line and then switch back to editor mode, you'll end up there.
- So, that's actually same with your second option, am I right? But of course, it's not smooth and works appropriately right now.
https://github.com/user-attachments/assets/03b6369a-4e66-413d-a8a6-6c541d1920c7
Yes, that's option 2 in rough form. What you found is an existing feature: with text selected in the preview, Ctrl+E opens the editor on those lines.
Here's how it compares with option 2:
| Now (select, then Ctrl+E) | Option 2 | |
|---|---|---|
| Trigger | You have to select text first | A single click is enough |
| Precision | Per line: selecting a word selects the whole line in the editor | Per character: the cursor lands on the character you clicked |
| Visible in the preview | Only your selection | A steady caret plus a faint highlight on the current line |
| Outline | Doesn't follow it | Follows it |
Does that match what you have in mind?
Yes, option 2 is nice.