mirror of
				https://github.com/9001/copyparty.git
				synced 2025-11-03 21:43:12 +00:00 
			
		
		
		
	fix markdown / text-editor jank
* only indicate file-history for markdown files since other files won't load into the editor which makes that entirely pointless; do file extension instead * text-editor: in files containing one single line, ^C followed by ^V ^Z would accidentally a letter and fix unhydrated extensions
This commit is contained in:
		@@ -152,6 +152,8 @@ RE_HSAFE = re.compile(r"[\x00-\x1f<>\"'&]")  # search always much faster
 | 
			
		||||
RE_HOST = re.compile(r"[^][0-9a-zA-Z.:_-]")  # search faster <=17ch
 | 
			
		||||
RE_MHOST = re.compile(r"^[][0-9a-zA-Z.:_-]+$")  # match faster >=18ch
 | 
			
		||||
RE_K = re.compile(r"[^0-9a-zA-Z_-]")  # search faster <=17ch
 | 
			
		||||
RE_HR = re.compile(r"[<>\"'&]")
 | 
			
		||||
RE_MDV = re.compile(r"(.*)\.([0-9]+\.[0-9]{3})(\.[Mm][Dd])$")
 | 
			
		||||
 | 
			
		||||
UPARAM_CC_OK = set("doc move tree".split())
 | 
			
		||||
 | 
			
		||||
@@ -5969,7 +5971,7 @@ class HttpCli(object):
 | 
			
		||||
        # [num-backups, most-recent, hist-path]
 | 
			
		||||
        hist: dict[str, tuple[int, float, str]] = {}
 | 
			
		||||
        histdir = os.path.join(fsroot, ".hist")
 | 
			
		||||
        ptn = re.compile(r"(.*)\.([0-9]+\.[0-9]{3})(\.[^\.]+)$")
 | 
			
		||||
        ptn = RE_MDV
 | 
			
		||||
        try:
 | 
			
		||||
            for hfn in bos.listdir(histdir):
 | 
			
		||||
                m = ptn.match(hfn)
 | 
			
		||||
@@ -6002,6 +6004,7 @@ class HttpCli(object):
 | 
			
		||||
 | 
			
		||||
        dirs = []
 | 
			
		||||
        files = []
 | 
			
		||||
        ptn_hr = RE_HR
 | 
			
		||||
        for fn in ls_names:
 | 
			
		||||
            base = ""
 | 
			
		||||
            href = fn
 | 
			
		||||
@@ -6056,11 +6059,13 @@ class HttpCli(object):
 | 
			
		||||
                zd.second,
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
            try:
 | 
			
		||||
                ext = "---" if is_dir else fn.rsplit(".", 1)[1]
 | 
			
		||||
            if is_dir:
 | 
			
		||||
                ext = "---"
 | 
			
		||||
            elif "." in fn:
 | 
			
		||||
                ext = ptn_hr.sub("@", fn.rsplit(".", 1)[1])
 | 
			
		||||
                if len(ext) > 16:
 | 
			
		||||
                    ext = ext[:16]
 | 
			
		||||
            except:
 | 
			
		||||
            else:
 | 
			
		||||
                ext = "%"
 | 
			
		||||
 | 
			
		||||
            if add_fk and not is_dir:
 | 
			
		||||
 
 | 
			
		||||
@@ -1078,26 +1078,28 @@ action_stack = (function () {
 | 
			
		||||
        var p1 = from.length,
 | 
			
		||||
            p2 = to.length;
 | 
			
		||||
 | 
			
		||||
        while (p1-- > 0 && p2-- > 0)
 | 
			
		||||
        while (p1 --> 0 && p2 --> 0)
 | 
			
		||||
            if (from[p1] != to[p2])
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
        if (car > ++p1) {
 | 
			
		||||
        if (car > ++p1)
 | 
			
		||||
            car = p1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        var txt = from.substring(car, p1)
 | 
			
		||||
        return {
 | 
			
		||||
            car: car,
 | 
			
		||||
            cdr: ++p2,
 | 
			
		||||
            cdr: p2 + (car && 1),
 | 
			
		||||
            txt: txt,
 | 
			
		||||
            cpos: cpos
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var undiff = function (from, change) {
 | 
			
		||||
        var t1 = from.substring(0, change.car),
 | 
			
		||||
            t2 = from.substring(change.cdr);
 | 
			
		||||
 | 
			
		||||
        return {
 | 
			
		||||
            txt: from.substring(0, change.car) + change.txt + from.substring(change.cdr),
 | 
			
		||||
            txt: t1 + change.txt + t2,
 | 
			
		||||
            cpos: change.cpos
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user