Program: 15192
Project: 15192
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
  if (event.getAction() > 1)   scrollDetected=true;
  if (event.getAction() == 1 && !scrollDetected && isFullScreenEditing) {
    Layout layout=((TextView)v).getLayout();
    int x=(int)event.getX();
    int y=(int)event.getY();
    if (layout != null) {
      int line=layout.getLineForVertical(y);
      int charPosition=layout.getOffsetForHorizontal(line,x);
      final Spannable s=content.getText();
      WPImageSpan[] click_spans=s.getSpans(charPosition,charPosition,WPImageSpan.class);
      if (click_spans.length != 0) {
        final WPImageSpan span=click_spans[0];
        if (!span.isVideo()) {
          LayoutInflater factory=LayoutInflater.from(EditPost.this);
          final View alertView=factory.inflate(R.layout.alert_image_options,null);
          final TextView imageWidthText=(TextView)alertView.findViewById(R.id.imageWidthText);
          final EditText titleText=(EditText)alertView.findViewById(R.id.title);
          final EditText caption=(EditText)alertView.findViewById(R.id.caption);
          final SeekBar seekBar=(SeekBar)alertView.findViewById(R.id.imageWidth);
          final Spinner alignmentSpinner=(Spinner)alertView.findViewById(R.id.alignment_spinner);
          ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(EditPost.this,R.array.alignment_array,android.R.layout.simple_spinner_item);
          adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          alignmentSpinner.setAdapter(adapter);
          imageWidthText.setText(String.valueOf(span.getWidth()) + "String_Node_Str");
          seekBar.setProgress(span.getWidth());
          titleText.setText(span.getTitle());
          caption.setText(span.getCaption());
          alignmentSpinner.setSelection(span.getHorizontalAlignment(),true);
          seekBar.setMax(100);
          if (span.getWidth() != 0)           seekBar.setProgress(span.getWidth() / 10);
          seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
            @Override public void onStopTrackingTouch(            SeekBar seekBar){
            }
            @Override public void onStartTrackingTouch(            SeekBar seekBar){
            }
            @Override public void onProgressChanged(            SeekBar seekBar,            int progress,            boolean fromUser){
              if (progress == 0)               progress=1;
              imageWidthText.setText(progress * 10 + "String_Node_Str");
            }
          }
);
          AlertDialog ad=new AlertDialog.Builder(EditPost.this).setTitle("String_Node_Str").setView(alertView).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
            public void onClick(            DialogInterface dialog,            int whichButton){
              span.setTitle(titleText.getText().toString());
              span.setHorizontalAlignment(alignmentSpinner.getSelectedItemPosition());
              span.setWidth(seekBar.getProgress() * 10);
              span.setCaption(caption.getText().toString());
            }
          }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
            public void onClick(            DialogInterface dialog,            int whichButton){
            }
          }
).create();
          ad.show();
          scrollDetected=false;
          return true;
        }
      }
 else {
        content.setMovementMethod(ArrowKeyMovementMethod.getInstance());
        content.setSelection(content.getSelectionStart());
      }
    }
  }
 else   if (event.getAction() == 1) {
    scrollDetected=false;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
  float pos=event.getY();
  if (event.getAction() == 0)   lastYPos=pos;
  if (event.getAction() > 1) {
    if (((lastYPos - pos) > 2.0f) || ((pos - lastYPos) > 2.0f))     scrollDetected=true;
  }
  lastYPos=pos;
  if (event.getAction() == 1 && !scrollDetected && isFullScreenEditing) {
    Layout layout=((TextView)v).getLayout();
    int x=(int)event.getX();
    int y=(int)event.getY();
    if (layout != null) {
      int line=layout.getLineForVertical(y);
      int charPosition=layout.getOffsetForHorizontal(line,x);
      final Spannable s=content.getText();
      WPImageSpan[] click_spans=s.getSpans(charPosition,charPosition,WPImageSpan.class);
      if (click_spans.length != 0) {
        final WPImageSpan span=click_spans[0];
        if (!span.isVideo()) {
          LayoutInflater factory=LayoutInflater.from(EditPost.this);
          final View alertView=factory.inflate(R.layout.alert_image_options,null);
          final TextView imageWidthText=(TextView)alertView.findViewById(R.id.imageWidthText);
          final EditText titleText=(EditText)alertView.findViewById(R.id.title);
          final EditText caption=(EditText)alertView.findViewById(R.id.caption);
          final SeekBar seekBar=(SeekBar)alertView.findViewById(R.id.imageWidth);
          final Spinner alignmentSpinner=(Spinner)alertView.findViewById(R.id.alignment_spinner);
          ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(EditPost.this,R.array.alignment_array,android.R.layout.simple_spinner_item);
          adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          alignmentSpinner.setAdapter(adapter);
          imageWidthText.setText(String.valueOf(span.getWidth()) + "String_Node_Str");
          seekBar.setProgress(span.getWidth());
          titleText.setText(span.getTitle());
          caption.setText(span.getCaption());
          alignmentSpinner.setSelection(span.getHorizontalAlignment(),true);
          seekBar.setMax(100);
          if (span.getWidth() != 0)           seekBar.setProgress(span.getWidth() / 10);
          seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
            @Override public void onStopTrackingTouch(            SeekBar seekBar){
            }
            @Override public void onStartTrackingTouch(            SeekBar seekBar){
            }
            @Override public void onProgressChanged(            SeekBar seekBar,            int progress,            boolean fromUser){
              if (progress == 0)               progress=1;
              imageWidthText.setText(progress * 10 + "String_Node_Str");
            }
          }
);
          AlertDialog ad=new AlertDialog.Builder(EditPost.this).setTitle("String_Node_Str").setView(alertView).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
            public void onClick(            DialogInterface dialog,            int whichButton){
              span.setTitle(titleText.getText().toString());
              span.setHorizontalAlignment(alignmentSpinner.getSelectedItemPosition());
              span.setWidth(seekBar.getProgress() * 10);
              span.setCaption(caption.getText().toString());
            }
          }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
            public void onClick(            DialogInterface dialog,            int whichButton){
            }
          }
).create();
          ad.show();
          scrollDetected=false;
          return true;
        }
      }
 else {
        content.setMovementMethod(ArrowKeyMovementMethod.getInstance());
        content.setSelection(content.getSelectionStart());
      }
    }
  }
 else   if (event.getAction() == 1) {
    scrollDetected=false;
  }
  return false;
}