Skip to content

Commit 059e8e2

Browse files
committed
Merge branch 'master' of https://github.com/qinci/AndroidEdit
2 parents 0c4fa2e + 123be7b commit 059e8e2

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
####EditText的撤销和恢复撤销操作
55
#####使用
66
* 引入库
7-
* compile 'ren.qinc.edit:lib:0.0.3'
7+
* compile 'ren.qinc.edit:lib:0.0.4'
88
* 初始化
99

1010
```java

gradle/push.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//参考http://www.jianshu.com/p/0ba8960f80a9
22
apply plugin: 'com.github.dcendents.android-maven'
33
apply plugin: 'com.jfrog.bintray'
4-
version = "0.0.3"
4+
version = "0.0.4"
55

66
def siteUrl = 'https://github.com/qinci/AndroidEdit' // 项目的主页
77
def gitUrl = 'https://github.com/qinci/AndroidEdit.git' // Git仓库的url

lib/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
defaultConfig {
77
minSdkVersion 9
88
targetSdkVersion 23
9-
versionCode 2
10-
versionName "1.2"
9+
versionCode 3
10+
versionName "1.3"
1111
}
1212
buildTypes {
1313
release {

lib/src/main/java/ren/qinc/edit/PerformEdit.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ public final void undo() {
8484
} else {
8585
//插销删除
8686
editable.insert(action.startCursor, action.actionTarget);
87-
editText.setSelection(action.startCursor, action.endCursor);
87+
if (action.endCursor == action.startCursor) {
88+
editText.setSelection(action.startCursor + action.actionTarget.length());
89+
} else {
90+
editText.setSelection(action.startCursor, action.endCursor);
91+
}
8892
}
8993
//释放操作
9094
flag = false;
@@ -151,7 +155,7 @@ public final void beforeTextChanged(CharSequence s, int start, int count, int af
151155
if (count > 1) {
152156
//如果一次超过一个字符,说名用户选择了,然后替换或者删除操作
153157
action.setSelectCount(count);
154-
}else if(count==1&&count==after){
158+
} else if (count == 1 && count == after) {
155159
//一个字符替换
156160
action.setSelectCount(count);
157161
}

0 commit comments

Comments
 (0)