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

multi buffer support in editor #65

Draft
wants to merge 72 commits into
base: main
Choose a base branch
from
Draft

Conversation

argshook
Copy link
Contributor

@argshook argshook commented Oct 6, 2022

This PR implements support for multiple editor tabs

image

  • at least 1 tab is always visible
  • open tab with
    • click + next to last tab
    • alt + t keyboard shortcut
    • menu (F1) entry "add new tab"
  • close tab with
    • click x on tab
    • alt + w keyboard shortcut
    • menu (F1) entry "close active tab"
  • tab content (internally called buffer) is saved to browsers IndexedDB
    (not localStorage anymore). This way no need to worry about 5MB
    browser storage limit, user can have as many tabs with as much content
    as they like
  • full editor view state is saved and restored. Previously only cursor
    position was saved. In addition to those, this PR now saves and
    restores text selection, scroll position and code folds
  • there's now a nice infra for managing buffers. Implementing things
    like "reopen closed tabs" and "tab drawer" will be trivial

@argshook argshook added enhancement New feature or request web-console Issues relevant to "web-console" package labels Oct 6, 2022
@argshook argshook self-assigned this Oct 6, 2022
@bluestreak01
Copy link
Member

there is tab flicker when new tab is added:

QuestDB.Console.-.Google.Chrome.2022-10-27.11-09-19.mp4

@bluestreak01
Copy link
Member

Not a fan of horizonal scrollbar:

image

@bluestreak01
Copy link
Member

when there are too many tabs, UX is terrible:

QuestDB.Console.-.Google.Chrome.2022-10-27.11-14-30.mp4

Compare this to Chrome UX at the same position:

New.Tab.-.Google.Chrome.2022-10-27.11-16-14.mp4

@argshook argshook marked this pull request as draft November 8, 2022 19:55
@argshook argshook marked this pull request as ready for review November 9, 2022 13:52
@argshook argshook marked this pull request as draft December 8, 2022 09:58
@bluestreak01
Copy link
Member

there is scroll bug - text I cannot access in editor:

image

@bluestreak01
Copy link
Member

let me summarise my feedback

ergonomics of the editor(s)

  • very good overall, nothing major. Editor content is memorised, so is cursor and scroll position.
  • small resize issue, if you move horizontal splitter up and down, in certain positions editor doesn't resize correctly

ergonomics of the tabs

  • look and feel should be consistent with tabs that switch between grid and charts. In fact these should not be copies but rather full on button reuse if possible. I hope react allows for that
  • I increasingly convince myself that google chrome's tab ergonomics are the best (and most proven)
  • new tab button should perhaps be more pronounced, including pronunciation of the hover. It should be entered
  • when tabs fill all available horizontal space "new tab" button should remain in place (it does already) and be perfectly entered (it isn't entered)
  • when space if filled and new tab is added, new and existing tabs should resize (shrink)
  • tabs should keep shrinking progressively. After some point lose text and keep shrinking icon until size at minimum
  • when tabs reach their absolute min size - the real estate of tabs should no longer change
  • ergonomics of tab close button are very good, close button stays in place while space is filled
  • tab resize should be animated (see how does chrome do animation)
  • opening and closing tabs should be animated in opposite directions (see chrome)
  • we can attempt to style all our tabs like chrome (https://adamschwartz.co/chrome-tabs/)

I am happy to help with all of this, but I will need pointers on how to do this in react efficiently. Perhaps some time to walk me thru the relevant code base ?

@argshook
Copy link
Contributor Author

@bluestreak01 thanks, Vlad, this is really helpful! I'll gromulate these points in my head and will get back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web-console Issues relevant to "web-console" package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants