From fc3ad3ff3fdefa4dfaeb1cd69477a1c4ca292c05 Mon Sep 17 00:00:00 2001 From: IsaiahPatton Date: Sun, 15 Jan 2023 22:31:59 -0500 Subject: [PATCH] Use the new SplitView to seperate tabs & terminal --- .github/workflows/blank.yml | 59 +------------------------------------ .github/workflows/rele.yml | 33 ++++++--------------- src/draw_events.v | 26 +++++++++------- src/ide.v | 25 ++++++++++++++-- src/verminal.v | 12 +++++--- 5 files changed, 56 insertions(+), 99 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index ed1f07f..2413162 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -139,61 +139,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: windows - path: vide_windows.zip - - release: - name: Create Github Release - needs: [build-linux, build-windows, build-macos] - runs-on: ubuntu-20.04 - steps: - - name: Get short tag name - uses: jungwinter/split@v1 - id: split - with: - msg: ${{ github.ref }} - seperator: / - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ steps.split.outputs._2 }} - name: ${{ steps.split.outputs._2 }} - commit: ${{ github.sha }} - draft: true - prerelease: false - - publish: - needs: [release] - runs-on: ubuntu-20.04 - strategy: - matrix: - version: [linux, macos, windows] - steps: - - uses: actions/checkout@v1 - - name: Fetch artifacts - uses: actions/download-artifact@v1 - with: - name: ${{ matrix.version }} - path: ./${{ matrix.version }} - - name: Get short tag name - uses: jungwinter/split@v1 - id: split - with: - msg: ${{ github.ref }} - seperator: / - - name: Get release - id: get_release_info - uses: bruceadams/get-release@v1.3.2 - env: - GITHUB_TOKEN: ${{ github.token }} - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.get_release_info.outputs.upload_url }} - asset_path: ${{ matrix.version }}/vide_${{ matrix.version }}.zip - asset_name: vide_${{ matrix.version }}.zip - asset_content_type: application/zip + path: vide_windows.zip \ No newline at end of file diff --git a/.github/workflows/rele.yml b/.github/workflows/rele.yml index 7155ea2..d37d9f4 100644 --- a/.github/workflows/rele.yml +++ b/.github/workflows/rele.yml @@ -19,7 +19,7 @@ jobs: with: # Default: ${{ github.token }} token: ${{ github.token }} - version: '0.3' + version: 'weekly.2023.02' version-file: '' check-latest: true stable: false @@ -32,8 +32,7 @@ jobs: sudo apt install build-essential sudo apt-get --yes --force-yes install libxi-dev libxcursor-dev mesa-common-dev sudo apt-get --yes --force-yes install libgl1-mesa-glx - git clone https://github.com/isaiahpatton/ui iui - cd iui + v install https://github.com/isaiahpatton/ui git clone https://github.com/isaiahpatton/vide v -cc $CC -skip-unused -gc boehm vide - name: Remove excluded @@ -41,10 +40,7 @@ jobs: rm -rf .git - name: Create ZIP archive run: | - cd iui zip -r9 --symlinks $ZIPNAME vide/ - mv $ZIPNAME ../ - cd .. - name: Create artifact uses: actions/upload-artifact@v2 with: @@ -62,7 +58,7 @@ jobs: with: # Default: ${{ github.token }} token: ${{ github.token }} - version: '0.3' + version: 'weekly.2023.02' version-file: '' check-latest: true stable: false @@ -70,8 +66,7 @@ jobs: - uses: actions/checkout@v1 - name: Compile run: | - git clone https://github.com/isaiahpatton/ui iui - cd iui + v install https://github.com/isaiahpatton/ui git clone https://github.com/isaiahpatton/vide v -cc $CC -skip-unused -gc boehm vide - name: Remove excluded @@ -79,10 +74,7 @@ jobs: rm -rf .git - name: Create ZIP archive run: | - cd iui zip -r9 --symlinks $ZIPNAME vide/ - mv $ZIPNAME ../ - cd .. - name: Create artifact uses: actions/upload-artifact@v2 with: @@ -100,7 +92,7 @@ jobs: with: # Default: ${{ github.token }} token: ${{ github.token }} - version: '0.3' + version: 'weekly.2023.02' version-file: '' check-latest: true stable: false @@ -112,9 +104,8 @@ jobs: git clone https://github.com/vlang/v cd v .\make.bat - git clone https://github.com/isaiahpatton/ui iui + .\v.exe install https://github.com/isaiahpatton/ui .\v.exe symlink - cd iui git clone https://github.com/isaiahpatton/vide v -cc gcc -skip-unused -gc boehm -cflags -static vide - name: Remove excluded @@ -122,23 +113,19 @@ jobs: run: | rm -rf .git cd v - cd iui cd vide rm -rf *.v rm -rf .git cd .. cd .. - cd .. - name: Create archive shell: msys2 {0} run: | cd v - cd iui cd vide cd .. powershell Compress-Archive vide $ZIPNAME - mv $ZIPNAME ../../ - cd .. + mv $ZIPNAME ../ cd .. # NB: the powershell Compress-Archive line is from: # https://superuser.com/a/1336434/194881 @@ -168,7 +155,7 @@ jobs: tag: ${{ steps.split.outputs._2 }} name: ${{ steps.split.outputs._2 }} commit: ${{ github.sha }} - draft: false + draft: true prerelease: false publish: @@ -192,11 +179,9 @@ jobs: seperator: / - name: Get release id: get_release_info - uses: leahlundqvist/get-release@v1.3.1 + uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} - with: - tag_name: ${{ steps.split.outputs._2 }} - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1.0.1 diff --git a/src/draw_events.v b/src/draw_events.v index 1564f3d..c877ea5 100644 --- a/src/draw_events.v +++ b/src/draw_events.v @@ -49,20 +49,15 @@ fn on_draw(mut win ui.Window, mut tb ui.Component) { tree := &ui.Tree2(win.get_from_id('proj-tree')) x_off := tree.x + tree.width + 4 - y_off := gg.window_size().height - 170 + ws := gg.window_size() - if tb.height != y_off { - tb.height = y_off - } - width := gg.window_size().width - x_off - 4 + width := ws.width - x_off - 4 if tb.width != width { tb.width = width } mut com := &ui.TextArea(win.get_from_id('consolebox')) - com.x = 0 // x_off - com.y = 0 // tb.y + tb.height + 5 if com.height < 100 { com.height = 134 } @@ -77,8 +72,19 @@ fn on_draw(mut win ui.Window, mut tb ui.Component) { com.width = width mut sv := &ui.ScrollView(win.get_from_id('vermsv')) - sv.x = x_off - sv.y = tb.y + tb.height + 5 - sv.height = 135 + + if com.height < sv.height { + com.height = sv.height + } + sv.width = width + + mut spv := &ui.SplitView(win.get_from_id('spv')) + spv.width = width + + height := ws.height - spv.y - 5 + + if spv.height != height { + spv.height = height + } } diff --git a/src/ide.v b/src/ide.v index c69c49b..619d59d 100644 --- a/src/ide.v +++ b/src/ide.v @@ -65,14 +65,14 @@ fn main() { mut tb := ui.tabbox(window) tb.set_id(mut window, 'main-tabs') - tb.set_bounds(4, 28, 200, 80) + tb.set_bounds(0, 0, 300, 400) tb.draw_event_fn = on_draw mut hbox := ui.hbox(window) tree := setup_tree(mut window, folder) hbox.add_child(tree) - hbox.add_child(tb) + // hbox.add_child(tb) hbox.draw_event_fn = fn (mut win ui.Window, mut hbox ui.Component) { size := win.gg.window_size() @@ -108,9 +108,28 @@ fn main() { mut sv := ui.scroll_view( view: console_box increment: 5 + bounds: ui.Bounds{ + height: 100 + } + padding: 0 ) sv.set_id(mut window, 'vermsv') - window.add_child(sv) + + mut spv := ui.split_view( + first: tb + second: sv + min_percent: 20 + h1: 70 + h2: 20 + bounds: ui.Bounds{ + y: 28 + x: 4 + } + ) + spv.set_id(mut window, 'spv') + hbox.add_child(spv) + + // window.add_child(sv) // basic plugin system // plugin_dir := os.real_path(os.home_dir() + '/vide/plugins/') diff --git a/src/verminal.v b/src/verminal.v index 11d5fb7..2ea5be2 100644 --- a/src/verminal.v +++ b/src/verminal.v @@ -37,7 +37,7 @@ fn box_draw(mut win ui.Window, com &ui.Component) { } if 'update_scroll' in win.extra_map { - jump_sv(mut win, this.height) + jump_sv(mut win, this.height, this.lines.len) win.extra_map.delete('update_scroll') } } @@ -55,7 +55,7 @@ fn before_txt_change(mut win ui.Window, tb ui.TextArea) bool { } is_enter := tb.last_letter == 'enter' - jump_sv(mut win, tb.height) + jump_sv(mut win, tb.height, tb.lines.len) if is_enter { mut tbox := &ui.TextArea(win.get_from_id('vermbox')) @@ -74,9 +74,13 @@ fn before_txt_change(mut win ui.Window, tb ui.TextArea) bool { return false } -fn jump_sv(mut win ui.Window, tbh int) { +fn jump_sv(mut win ui.Window, tbh int, lines int) { mut sv := &ui.ScrollView(win.get_from_id('vermsv')) val := tbh - sv.height + if lines <= 1 { + sv.scroll_i = 0 + return + } sv.scroll_i = val / sv.increment } @@ -114,7 +118,7 @@ fn on_cmd(mut win ui.Window, box ui.TextArea, cmd string) { verminal_cmd_exec(mut win, mut tbox, args) } - jump_sv(mut win, box.height) + jump_sv(mut win, box.height, tbox.lines.len) win.extra_map['update_scroll'] = 'true' win.extra_map['lastcmd'] = cmd