问题标签 [undo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
499 浏览

.net - Implement data rollback in existing CRUD app

I have an existing CRUD app that I have been tasked with implementing "tomb stoning". I need a way to allow a user to roll a given page of data back to the previous state.

Say I have First Name, Last Name, and Social Security Number on a page in this app. User A updates the Last Name field. Later, User B notices that the New Last Name is different and wants to see Who changed it and roll it back if neccessary.

I am unfamilar with this so if I am missing or misusing some terms, forgive me.

This app has a MS SQL backend and the DAL is mostly SPROCS. Right now there isn't any archiving or tomb stoning to speak of.

I had thought to just make a table for each existing table called tblPerson --> tblPersonTombstone and then the roll back portion would read from that table. Unfortunately, the original DB designers designed it in such a way that a Single page in the App might contain info from 2 or 3 different tables. Thus, I would imagine, I need a more Transaction based approach.

Any direction or pointers will be greatly appreciated. Am I on the right track with my thinking? Maybe I am over complicating it? How have others done it?

I see this post How to implement ‘undo’ operation in .net windows application? and also this one New CodePlex project: a simple Undo/Redo framework but I am concered that neither fit my actual situaiton. I am not looking to let the users click ctl+z. I need to let them roll a whole page back to a previous state. If I am misunderstanding the use of those two examples then please say so.

Thanks for the time.

0 投票
12 回答
462888 浏览

git - 如何撤消“git commit --amend”而不是“git commit”

我不小心修改了我之前的提交。提交应该是分开的,以保留我对特定文件所做更改的历史记录。

有没有办法撤消最后一次提交?如果我做类似的事情git reset --hard HEAD^,第一次提交也会被撤消。

(我还没有推送到任何远程目录)

0 投票
5 回答
3557 浏览

python - Python:撤消写入文件

撤消写入文件的最佳方法是什么?如果我正在经历一个循环并一次写一行,并且我想撤消先前的写入并用其他内容替换它,我该怎么做呢?有任何想法吗?

提前致谢!

0 投票
10 回答
57071 浏览

svn - 有没有办法从意外的“svn revert”中恢复?

今天早上,我通过执行以下操作成功地射中了自己的脚:

  1. 开始对我的项目进行更改
  2. 对一堆文件进行了一堆编辑
  3. 意识到我的方法全错了,我需要重新开始
  4. cd'd 到我项目的顶层并执行“svn --recursive revert”。将我的本地沙箱恢复到更改前的状态。
  5. 当我意识到我的本地沙盒中还有许多其他未完成的变化时,我惊恐地嚎叫着,而我刚刚将它们全部抹去。(上周五 svn 服务器宕机了,所以我没能签到,周末忘记了)

幸运的是,在这种情况下,我在周五下班前做了一个“svn diff > temp.txt”,而 temp.txt 文件仍在我的硬盘上,所以我能够将该文件输入“补丁”并恢复我的丢失的变化。

但是为了我将来的参考(即下次我犯同样的愚蠢错误)......有没有办法告诉svn撤消“svn revert”?svn 是否在任何地方保留本地/未签入差异的备份?

0 投票
1 回答
185 浏览

objective-c - 在 Modified、Bound、NSAttributedString 中维护 Undo

我有一个绑定到 NSTextView 的属性字符串。每次编辑字符串时,我都使用一种调用方法(使用 KVO),以根据正则表达式匹配向字符串添加背景颜色属性。我通过使用-initWithAttributedString:then -beginEditing, -addAttribute:,来创建一个新的可变属性字符串来做到这一点-endEditing。一旦我添加了我想要的所有背景颜色属性,我就会调用字符串的 setter[self setTextViewString:mutableAttributedString]问题是,如果实际上有任何属性添加到字符串中,它会终止撤消并将光标移动到字符串的末尾。

如何保持撤消?我通过在 setter 的任一侧调用 textView 的 selectedRanges 和 setSelectedRanges: 方法来保持光标位置,但这似乎仍然有点骇人听闻。

我无法将 textview 直接绑定到 mutableattributedstring,但似乎应该有一种更直接的方法来修改绑定的字符串,这样它就不会弄乱编辑。

PS,属性的添加发生在 KVO 方法通过调用完成之后,-performSelectorOnMainThread:这是我可以让添加的属性显示的唯一方法。

0 投票
10 回答
311853 浏览

vim - 我如何在 Vim 中进行重做(即“撤消撤消”)?

在 Vim 中,我做了太多撤消操作。如何撤消此操作(即重做)?

0 投票
2 回答
528 浏览

tfs - 撤消 TFS 操作?

我在 TFS 中得到了“解决”对话框,看起来我在错误的按钮上单击得太快了(因为它们靠得太近了),当 TFS 放弃了我的本地更改时,我花了一周的时间工作。某处是否有撤消操作?

0 投票
2 回答
681 浏览

objective-c - 有没有办法查看撤消堆栈?

我正在学习撤消,我想要一种方法来查看其中的撤消对象(NSInvocations),undoManager这样我就可以看到发生了什么。我在文档中看不到这样的东西,但也许有人知道一种方法。

谢谢。

0 投票
2 回答
258 浏览

iphone - 为什么此代码无法清空撤消堆栈

使用此代码,我仍然在撤消堆栈上删除,即使取消注释这两行也无法阻止记录。为什么?

0 投票
22 回答
4588487 浏览

git - 将本地存储库分支重置为就像远程存储库 HEAD

如何将我的本地分支重置为就像远程存储库上的分支一样?

我做了:

但是当我运行一个git status,

你能告诉我为什么我有这些'修改'?我没碰过这些文件?如果我这样做了,我想删除这些。