mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
selectionString: realloc so free gets the correct length
This commit is contained in:
@ -469,7 +469,10 @@ pub fn selectionString(self: Screen, alloc: Allocator, sel: Selection) ![:0]cons
|
|||||||
|
|
||||||
// Add null termination
|
// Add null termination
|
||||||
buf[i] = 0;
|
buf[i] = 0;
|
||||||
return buf[0..i :0];
|
|
||||||
|
// Realloc so our free length is exactly correct
|
||||||
|
const result = try alloc.realloc(buf, i + 1);
|
||||||
|
return result[0..i :0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the slices that make up the selection, in order. There are at most
|
/// Returns the slices that make up the selection, in order. There are at most
|
||||||
|
Reference in New Issue
Block a user