Git Product home page Git Product logo

Comments (15)

siduck avatar siduck commented on September 25, 2024 1

I patched it now , it works but

  • whenever I open the terminal and try "scroll forward" first, the terminal force exits itself (segmentation fault)
  • but if I try "scroll backward" + "scroll forward" then the terminal doesnt exit itself

changes made

If you want to test this build

git clone https://github.com/siduck76/st --branch test

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024 1

cool :) that looks good I'll have a look at the segfault that when I find the time :) And I'll keep the issue open for those who are interested!

I think the segfault might be because some areas are uninitialized and interpreted incorrectly, but thats just a hunch

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

Hi! :)
I don't release that patch separately, you can extract it by cloning this repo and executing

./release.sh 1 1

which generates all patches (including the column patch) from the current state of the repo.

Note:

  • Note that this patch is based on my history implementation.
  • Please be aware that a SEGFAULT might occur in your st when you apply the column patch, I'll have to sort that one out sometimes later (#16). For me this issue is not a big deal, because since using my st setup for a year st only crashed on me twice, but things might be different if you are on a more sophisticated tiling WM than I am operating on which supports manually resizing windows.

There is also a patch which does what you'ld like to achive without the history patch pre-applied which I released, but it has got the same issue (discussed here, patch linked in the ticket).

I hope that helps!

from st-history-vim.

siduck avatar siduck commented on September 25, 2024

@juliusHuelsmann Does column_patch remove the functionality of mouse scroll? Ive tried vim-browse , it was great but I needed the mouse scroll support somehow :(

Also whats the difference between these two?

image

All I want is text not being cut when I resize my terminal :

simplescreenrecorder-2021-06-10_17.56.15.mp4

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

Scrolling via mouse
Sorry, the mouse scroll functionality is only available with the scrollback patch, vim browse and the column patch use the history patch which is a part of this repo which does not support scrolling via mouse. If you've worked with C you could port the mouse scroll scrollback patch to this history patch, but I think this would only be worth the effort if you plan to use both vim patch and scrolling via mouse.

Difference between patches

What is the difference [..]

The first one is the column patch, the second one only the history patch built to be applied on top of commit 43a3..

What you should apply for your use-case
I think then what you want is to apply the patch I release here.
However, note the following things:

  1. The snipplet I linked above was only ment for show-casing how one would implement this feature.
  2. Note that this patch might cause trouble because the terminal might crash as reported here. The person who reported this also mentioned that they have a fix for it in their repo, maybe it'ld be worth checking that out (link in the issue).

I'll have a look at the cause of the error sometimes this year, but I don't know when (It's likely not too hard to track down, but I'm currently rather busy). If you want I can notify you once I fixed that, I'll just keep this issue open then

from st-history-vim.

siduck avatar siduck commented on September 25, 2024

Oh idk C and I have the scrollback patch already applied but it doesnt function at all once I patch vim-browse patch :((

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

Ok looking at the patch again I think I mid've found the root of the bug, maybe this works, didn't test though and I'm currently unsure what the semantics were for clearing the region (meaning of var pmc). If you try this out please come back and say if it is buggy or not, I'll have a look at this later either way.

From d07e686a604eba95f8ef84f2efce946427771f67 Mon Sep 17 00:00:00 2001
From: Julius Huelsmann <juliusHuelsmann@gmail.com>
Date: Thu, 24 Dec 2020 00:34:38 +0100
Subject: [PATCH] feat: create column patch equivalent for unpatched st

Equivalent to history-column patch in https://github.com/juliusHuelsmann/st-history-vim only without ability to inspect if terminal size is smaller.
---
 st.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/st.c b/st.c
index abbbe4b..11c768e 100644
--- a/st.c
+++ b/st.c
@@ -113,6 +113,7 @@ typedef struct {
 typedef struct {
 	int row;      /* nb row */
 	int col;      /* nb col */
+	int maxCol;
 	Line *line;   /* screen */
 	Line *alt;    /* alternate screen */
 	int *dirty;   /* dirtyness of lines */
@@ -1236,6 +1237,7 @@ tclearregion(int x1, int y1, int x2, int y2)
 	LIMIT(x2, 0, term.col-1);
 	LIMIT(y1, 0, term.row-1);
 	LIMIT(y2, 0, term.row-1);
+	if (!(term.mode &= MODE_ALTSCREEN) && x2 == term.col - 1) { x2 = term.maxCol -1; }
 
 	for (y = y1; y <= y2; y++) {
 		term.dirty[y] = 1;
@@ -2472,9 +2474,10 @@ twrite(const char *buf, int buflen, int show_ctrl)
 void
 tresize(int col, int row)
 {
-	int i;
+	int i;
+	int pmc = term.maxCol;
 	int minrow = MIN(row, term.row);
 	int mincol = MIN(col, term.col);
+	term.maxCol = MAX(col, pmc);
 	int *bp;
 	TCursor c;
 
@@ -2511,14 +2514,14 @@ tresize(int col, int row)
 
 	/* resize each row to new width, zero-pad if needed */
 	for (i = 0; i < minrow; i++) {
-		term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
-		term.alt[i]  = xrealloc(term.alt[i],  col * sizeof(Glyph));
+		term.line[i] = xrealloc(term.line[i], term.maxCol * sizeof(Glyph));
+		term.alt[i]  = xrealloc(term.alt[i],  term.maxCol * sizeof(Glyph));
 	}
 
 	/* allocate any new rows */
 	for (/* i = minrow */; i < row; i++) {
-		term.line[i] = xmalloc(col * sizeof(Glyph));
-		term.alt[i] = xmalloc(col * sizeof(Glyph));
+		term.line[i] = xmalloc(term.maxCol * sizeof(Glyph));
+		term.alt[i] = xmalloc(term.maxCol * sizeof(Glyph));
 	}
 	if (col > term.col) {
 		bp = term.tabs + term.col;
@@ -2540,7 +2543,7 @@ tresize(int col, int row)
 	c = term.c;
 	for (i = 0; i < 2; i++) {
 		if (mincol < col && 0 < minrow) {
-			tclearregion(mincol, 0, col - 1, minrow - 1);
+			tclearregion(pmc, 0, col - 1, minrow - 1);
 		}
 		if (0 < col && minrow < row) {
 			tclearregion(0, minrow, col - 1, row - 1);
-- 
2.29.2

from st-history-vim.

siduck avatar siduck commented on September 25, 2024

This patch doesnt depend on other patches right?

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

Oh , I have the scrollback patch already applied but it doesnt function at all once I patch vim-browse patch :((

No sorry, the vim-browse patch is not compatible with the scrollback patch

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

This patch doesnt depend on other patches right?

Right, this shouldn't depend on other patches, however I created it on an old revision of st, there might therefore be some merge conflicts

from st-history-vim.

siduck avatar siduck commented on September 25, 2024

Oh , I have the scrollback patch already applied but it doesnt function at all once I patch vim-browse patch :((

No sorry, the vim-browse patch is not compatible with the scrollback patch

Is column_patch compatible with scrollback ? I get this error while patching :

image

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

Hi! Hope this helps:
put it on this branch but unsure if this version is bugfree (as mentioned above)

git pull
git checkout test-persistent-col
make clean && make
./st # < try if it works
git diff fa253f0 > diff
# wherever you'ld like to apply it: patch -p1 < [path-to-diff]/diff 

Is column_patch compatible with scrollback ? I get this error while patching

The column-patch is not compatible with scrollback.
However, the patch on the branch above is. Note that it might be buggy, it might also work fine, but I recommend to test it first

from st-history-vim.

siduck avatar siduck commented on September 25, 2024

@juliusHuelsmann this works but all glyphs like icons look very weird and st force exits itself frequently
image

from st-history-vim.

juliusHuelsmann avatar juliusHuelsmann commented on September 25, 2024

ok sorry then there is still something wrong with that patch, I'll notify you in this issue when there is an update!

from st-history-vim.

siduck avatar siduck commented on September 25, 2024

no worries! I will try these diffs from here and try patching it.
image

from st-history-vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.