-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using .
(repeat) for a replacement of text freezes up in 'C'
#16460
Comments
@natac13 I cannot reproduce this. Can you still? |
I did an update to Zed and it freezes a lot less (almost not at all) but now does some weird thing where it adds a In the video I am trying to do At 11 seconds where it looks like Im just sitting there doing nothing, I am actually hammering my period key 🤣 Here is the exact file if you need #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct lnode {
char *text;
struct lnode *next;
};
struct krlist {
struct lnode *head;
struct lnode *tail;
int count;
};
// Constructor - lst = list()
struct krlist *krlist_new() {
struct krlist *p = malloc(sizeof(*p));
p->head = NULL;
p->tail = NULL;
p->count = 0;
return p;
}
// Destructor - del lst
void krlist_del(struct krlist *self) {
struct lnode *cur, *next;
cur = self->head;
while (cur) {
free(cur->text);
next = cur->next;
free(cur);
cur = next;
}
free((void *)self);
}
void krlist_print(struct krlist *self) {
struct lnode *cur;
int i = 0;
cur = self->head;
printf("[");
while (cur) {
if (i++ > 0) {
printf(", ");
}
printf("'%s'", cur->text);
cur = cur->next;
}
printf("]\n");
}
void krlist_append(struct krlist *self, char *text) {
// Create a new node
struct lnode *node = malloc(sizeof(*node));
// create a new text buffer
node->text = malloc(strlen(text) + 1);
// copy the text into the new node
strcpy(node->text, text);
// node->text = text;
node->next = NULL;
if (self->count == 0) {
self->head = node;
} else {
// update the next pointer of the current tail
// check if the tail is NULL
if (self->tail == NULL) {
printf("Error: tail is NULL\n");
exit(1);
}
self->tail->next = node;
}
self->tail = node;
self->count++;
}
int krlist_len(struct krlist *self) { return self->count; }
int krlist_index(struct krlist *self, char *str) {
struct lnode *cur;
int i = 0;
cur = self->head;
while (cur) {
if (strcmp(cur->text, str) == 0) {
return i;
}
cur = cur->next;
i++;
}
return -1;
}
int main() {
struct krlist *lst = krlist_new();
krlist_append(lst, "Hello World");
krlist_print(lst);
pylist_append(lst, "Catch phrase");
krlist_print(lst);
pylist_append(lst, "Brian");
pylist_print(lst);
pylist_len(lst);
pylist_index(lst, "Brian");
pylist_index(lst, "Bob");
pylist_del(lst);
}
|
Check for existing issues
Describe the bug / provide steps to reproduce it
I have been trying to explore some 'C' and was going through cc4e.com. I wanted to change string like
pylist_get
tokrlist_get
or vice versa.I went to the front of
pylist_get
and didctl
kr
for change to 'l'. When I navigated to the next match either manually or withn
on a search match, and pressed.
it would sometimes work the first time but doing so on the second repeat froze the editor. I had to force quit and try again. I have repeated this a few times.Then I noticed if I left it for long enough and somehow it did not freeze then ALL the matches would be changed at once instead of in match by match way as expected
In the log file at the bottom I see an 'Aborting replay after 10000 actions`
Environment
Zed: v0.148.1 (Zed)
OS: macOS 14.5.0
Memory: 32 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
Code
main
function and try to change thekrlist_...
topylist_...
withctl
and then do a repeat on the next match with.
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: