When the terminal refused to list the open folder, for example after its API key changed, pressing Refresh above the Files list kept the old entries on screen and said nothing. Refresh now clears the list and any ticked items and shows "Failed to load directory. Check your Terminal connection in Settings → Integrations.", the same as opening the folder does, and the next Refresh lists the folder again once the terminal answers. The list also reads itself again after a sort change, showing hidden files, a file change or a change on the terminal, and those reads show the same message when they fail.
Fixes#34550
* fix: an unsaved edit in a terminal file is lost when another chat is opened
An edit typed into a file opened from the terminal's Files tab and not saved yet was gone after opening another chat and coming back: the file's tab showed the last saved version and lost its unsaved mark, without any warning. The app keeps such an edit in memory when you leave a chat, but a second copy taken while the chat was being closed, when the editor was already gone, overwrote it with one that had no edit in it. Now the edit and its unsaved mark are back when you return to the chat, the same as after switching to another tab in the same chat.
Fixes#34107
* fix: a workbook saved while leaving the chat comes back on its first worksheet
When a workbook save was still running as you switched to another chat, the workbook came back on its first worksheet instead of the one you had open. The late save result now keeps the rest of the file's view, so the worksheet you were on is still selected when you return.
* fix: an unsaved edit in a terminal file is lost when another chat is opened
Shortens the note on why the file view keeps its last full state after the chat is closed.
* Say why the view is reused after teardown
* Name the kept view like the file's other remembered values
* fix: the file browser's right-click menu opens outside the window near the lower or right edge
A right click on the empty part of the Files list opened its menu down and to the right of the pointer whatever space was left, so near the lower edge of the window most of its entries were out of reach and near the right edge it was cut off. The menu now opens upwards when there is no room below the pointer and to the left when there is no room to its right, so all of it stays inside the window.
Fixes#34097
* fix: the file browser's right-click menu opens outside the window near the lower or right edge
Writes the menu placement the same way the Ask about this file box already does.
* feat: outline of a Markdown file's headings in the terminal file preview
Long Markdown files in a terminal's Files preview could only be navigated by scrolling, which gets slow in a report with hundreds of sections. The preview toolbar now has an Outline button that lists the document's headings, indented by level, and picking one with the mouse or keyboard jumps straight to that section. The button shows only for Markdown files that have headings, and not in the Source view.
* feat: show the Outline button on every Markdown file
The Outline button in a terminal's Files preview only appeared when the file had headings, and the check that decided this missed some headings and counted front matter as one. It now shows on every Markdown file outside the Source view, and for a file without headings the list shows "No results".
* Leave the English catalog out of the outline change
* Keep the English catalog as it is on the base
Picking a different terminal for a chat left the open Files tab showing the previous terminal's folder and files, while the chat itself was set to the new terminal. Seeing the new terminal's files meant opening Files again from the + menu. The Files tab now moves to the newly picked terminal and shows its files, as the file browser did in 0.12. With a terminal set to Per chat, the tab shows that chat's own files once the first message creates the chat.
Fixes#33951