Skip to content

Commit

Permalink
Use the new SplitView to seperate tabs & terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
pisaiah committed Jan 16, 2023
1 parent d0005b8 commit fc3ad3f
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 99 deletions.
59 changes: 1 addition & 58 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
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
33 changes: 9 additions & 24 deletions .github/workflows/rele.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,19 +32,15 @@ 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
run: |
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:
Expand All @@ -62,27 +58,23 @@ jobs:
with:
# Default: ${{ github.token }}
token: ${{ github.token }}
version: '0.3'
version: 'weekly.2023.02'
version-file: ''
check-latest: true
stable: false
architecture: ''
- 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
run: |
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:
Expand All @@ -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
Expand All @@ -112,33 +104,28 @@ 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
shell: msys2 {0}
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
Expand Down Expand Up @@ -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:
Expand All @@ -192,11 +179,9 @@ jobs:
seperator: /
- name: Get release
id: get_release_info
uses: leahlundqvist/[email protected].1
uses: bruceadams/[email protected].2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.split.outputs._2 }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
Expand Down
26 changes: 16 additions & 10 deletions src/draw_events.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
}
25 changes: 22 additions & 3 deletions src/ide.v
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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/')
Expand Down
12 changes: 8 additions & 4 deletions src/verminal.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
Expand All @@ -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'))
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fc3ad3f

Please sign in to comment.